ak5745
asked on
Appending Array to Excel Using C#
Experts,
I'm trying to append an array of strings to an already existing Excel 2007 file - there's already data in the file, and I'd like to add my new data to the first empty row.
As File.AppendAllText doesn't exist in this context, is there something that will give me the same usability? Any tips? Thanks!
I'm trying to append an array of strings to an already existing Excel 2007 file - there's already data in the file, and I'd like to add my new data to the first empty row.
As File.AppendAllText doesn't exist in this context, is there something that will give me the same usability? Any tips? Thanks!
ASKER
Thanks for the reply. I'd like to have the capability of opening Excel and having all my data there already without having any additional steps.
If this is not possible, then I'll probably lean towards the csv route.
Any other ideas?
If this is not possible, then I'll probably lean towards the csv route.
Any other ideas?
The only thing I can think of is
Save as csv
Create an excel document with a macro that opens the required file and the csv and then appends the data the existing file
Set the macro to run on file open
Call this document from your application
Problem is that this method is messy and there must be a better way to solve the issue
Michael
Save as csv
Create an excel document with a macro that opens the required file and the csv and then appends the data the existing file
Set the macro to run on file open
Call this document from your application
Problem is that this method is messy and there must be a better way to solve the issue
Michael
ASKER
You're right, it is messy. I know what I'm describing here is essentially a log in excel. Given I can do this, I'd like entries to be added with most recent being placed on top (below a header), where I'll eventually use excel to do analysis of this data.
ASKER
Does anyone already do this in any apps they manage? It doesn't strike me as cosmic, but maybe it is. Anyone have any tips/code snippets that might help me out?
Thanks.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I found a solution that works for me. Hope it's useful.
Michael