FAQ
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

Search Discussions

  • Jason Scheirer at Jan 9, 2010 at 8:47 am

    On Jan 9, 12:30?am, pp 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
    http://pypi.python.org/pypi/xlwt
  • Pp at Jan 9, 2010 at 8:58 am

    On Jan 9, 1:47?am, Jason Scheirer wrote:
    On Jan 9, 12:30?am, pp 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
    http://pypi.python.org/pypi/xlwt
    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.


    Thanks.
  • Steve Holden at Jan 9, 2010 at 12:59 pm

    pp wrote:
    On Jan 9, 1:47 am, Jason Scheirer wrote:
    On Jan 9, 12:30 am, pp 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
    http://pypi.python.org/pypi/xlwt
    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.

    regards
    Steve
    --
    Steve Holden +1 571 484 6266 +1 800 494 3119
    PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/
    Holden Web LLC http://www.holdenweb.com/
    UPCOMING EVENTS: http://holdenweb.eventbrite.com/
  • Niels L. Ellegaard at Jan 9, 2010 at 10:33 pm

    pp <parul.pandey85 at gmail.com> writes:
    On Jan 9, 1:47?am, Jason Scheirer wrote:
    On Jan 9, 12:30?am, pp 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
    http://pypi.python.org/pypi/xlwt
    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.
    I may be wrong, but I think that you have to do the following

    1) Use xlrd to read the file. This creates an xlrd.Book
    2) Use xlutils to transform the xlrd.Book into a xlwt.WorkBook
    3) Edit the xlwt.WorkBook
    4) Save the xlwt.WorkBook

    https://secure.simplistix.co.uk/svn/xlutils/trunk/xlutils/docs/copy.txt

    Niels
  • Chris Withers at Jan 12, 2010 at 8:14 am

    Niels L. Ellegaard wrote:
    pp <parul.pandey85 at gmail.com> writes:
    On Jan 9, 1:47 am, Jason Scheirer wrote:
    On Jan 9, 12:30 am, pp 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
    http://pypi.python.org/pypi/xlwt
    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.
    I may be wrong, but I think that you have to do the following

    1) Use xlrd to read the file. This creates an xlrd.Book
    2) Use xlutils to transform the xlrd.Book into a xlwt.WorkBook
    3) Edit the xlwt.WorkBook
    4) Save the xlwt.WorkBook

    https://secure.simplistix.co.uk/svn/xlutils/trunk/xlutils/docs/copy.txt
    Yup, that's the one...

    Oh to have funded time to turn all the docs for xl(rd|wt|utils) into
    nice Sphinx docs...

    Chris

    --
    Simplistix - Content Management, Batch Processing & Python Consulting
    - http://www.simplistix.co.uk

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJan 9, '10 at 8:30a
activeJan 12, '10 at 8:14a
posts6
users5
websitepython.org

People

Translate

site design / logo © 2022 Grokbase