Append to an Excel file

Steve Holden steve at
Sat Jan 9 13:59:01 CET 2010

pp wrote:
> On Jan 9, 1:47 am, Jason Scheirer <jason.schei... at> wrote:
>> On Jan 9, 12:30 am, pp <parul.pande... at> wrote:
>>> Hi All,
>>> How do I add a line to an existing file. This should append to the
>>> existing data in the excel file, which was saved previously.
>>> Thanks,
>>> PP
> Hi Jason and all,
> Thanks
> I have seen this.. my question is there a  way to append to a excel
> file which has been closed. Any specific modes which can be added to
> the sheet so that it adds a line to the data which was return in some
> earlier running of the program.
If you are talking about an XLS file and not a CSV then it's a highly
structured object, and you can't just "stick bits on the end" with any
expectation that Excel will know what to do with the new data.  The most
likely outcomes would be Excel either complaining the file format is
invalid or ignoring the extra data.

If it's a CSV file, then f = open(file, "a") should do it.

Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010
Holden Web LLC       

More information about the Python-list mailing list