Adding a row to an excel file

  • Thread starter Thread starter James Alba
  • Start date Start date
J

James Alba

Is it possible to (1) create a new excel worksheet and write to it, (2) save
and close it, AND THEN (3) reopen it and CONTINUE adding rows where you left
off? I am making an application which logs events, where each event is
written to a new row. If so, then how?

I'm using C# with .NET and MS office 2003.

Thanks in advance.
 
James Alba <[email protected]> said:
Is it possible to (1) create a new excel worksheet and write to it, (2) save
and close it, AND THEN (3) reopen it and CONTINUE adding rows where you left
off? I am making an application which logs events, where each event is
written to a new row.

Yes. You just need somewhere to store the last row number; somewhere in
the spreadsheet, for example. Or you could iterate through the rows
until you find an empty one.

Personally, I'd write to a text file. It's easier, faster, doesn't load
the Excel Monster into memory and doesn't depend on Excel being
installed. You can always import it into Excel.
 
Back
Top