473,394 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to append Data to an existing Excel file?

How to append Data to an existing Excel file?
means,
I'm using VB as front end & once I exported the data to Excel file & saved it as 'ABC.xls'.

Now, the question/doubt is;
I addded some more records in VB.
Now if I want to export these newly updated records to an already existing file 'ABC.xls' what shall I do..?
Could anybody help me...? Pls....


Thanks in advance.
Waiting for your answer.
Jan 15 '09 #1
3 23727
This solution will help you find the first empty row number in a spreadsheet. After you know that number you would used the standard expression like worksheet.range("A1").value.

Dim excelApp As Excel.Application = New Excel.Application()
Dim excelBook As Excel.Workbook
Dim strPath As String = "C:\Documents and Settings\All Users\Documents\Intranet\Sysco ARL\uniqueinv-20081201-024-ALL.xls"
excelBook = excelApp.Workbooks.Open(strPath, 0, False, 5, _
System.Reflection.Missing.Value, System.Reflection.Missing.Value, _
False, System.Reflection.Missing.Value, System.Reflection.Missing.Value, _
True, False, System.Reflection.Missing.Value, False)
Dim excelSheets As Excel.Sheets = excelBook.Sheets
Dim excelSheet As Excel.Worksheet = excelSheets(1)
Dim excelRange As Excel.Range = excelSheet.UsedRange
excelRange.SpecialCells(Excel.XlCellType.xlCellTyp eLastCell).Activate()
Dim intNewRow As Int32 = excelApp.ActiveCell.Row + 1
Dim strNewCellAddress As String = "A" & intNewRow
excelSheet.Range(strNewCellAddress).Value = "this data goes in the first empty row"
excelBook.Save()
excelBook.Close()
excelApp.Quit()
Jan 16 '09 #2
ThanQ for your reply SIr.
I will try it.

Thanks & regards,
Prem
Jan 17 '09 #3
Kolags
9
Thank you mrmelvin.
Your Solution is prefectly suitable to my problem.
May 6 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Zero | last post by:
how to Overwrite Existing Excel File without prompt and quit?
2
by: bienwell | last post by:
Hi all, Do you have any source code to import data from Excel file or text file into database in ASP.NET program ? Please give me your reference if you have. Thanks in advance
1
by: madhu sudhan | last post by:
HI, I want to read data from excel file and export this data to dataset. I know abt the basics of opening a file using application, workbook and worksheet classes. But i don't know how to read...
6
by: jcf378 | last post by:
hello-- i am having trouble figuring out how to export individual records from an Access 2002 Form into a pre-existing Excel spreadsheet, such that the exported record is merely appended to the...
5
by: Aspgm | last post by:
Hi Everyone, I have an Excel file to update on-line using ASP. I could write data to a fresh excel file. But I couldn't find a way to open an existing Excel file and update relevant cells. If...
4
by: student491 | last post by:
Hello, i tried to open existNg Excel file by using follow metho bt it give error ... that this file doestnt exist or path is incorrect........ wb =...
3
by: thanawala27 | last post by:
Hi, I had problems writing in an existing Excel File. There is an excel file with a worksheet. I would like to open this existing Excel file and add another worksheet and write data into it....
1
by: arshigill | last post by:
I want to import data from excel file inot mysql database table but unable to solve this problem. I have searched google and find an example of importing of CSV excel file. But when I modify it...
0
by: JFKJr | last post by:
Hello everyone! I am trying to export Access table data into Excel file in such a way that the table field names should be in the first line of each column in excel file followed by field data, and...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.