473,397 Members | 1,960 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,397 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 23729
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.