Python to Combine Multiple Excel Worksheets into One Worksheet

Discussion in 'Python' started by SMac2347@comcast.net, Feb 15, 2012.

  1. Guest

    Hello,

    I have one single Excel file with many separate worksheets, and for
    work I need to combine all these separate worksheets into one single
    worksheet (I am not worried about formatting, as the format is the
    same in each sheet, nor am I worried about Excel's row limit).
    Essentially, I am looking for a way to append the data in one sheet to
    the bottom of the sheet that proceeds it.

    What would be the best way to do this, and how would I go about doing
    it? Can it be done simply with the xlwt, xlrd, and xutils modules, or
    (as I was thinking) do I need to convert the sheets to separate csv
    files, then append the separate csv files, and then write the
    completed file back into .xls format? Or perhaps something else?

    As I am really only a Python beginner, any and all help is very much
    appreciated. Thank you in advance!!
     
    , Feb 15, 2012
    #1
    1. Advertising

  2. >I have one single Excel file with many separate worksheets, and for work Ineed to combine all these separate worksheets into one single worksheet (Iam not worried about formatting, as the format is the same in each sheet, nor am I worried about Excel's row limit).

    >Essentially, I am looking for a way to append the data in one sheet to the bottom of the sheet thatproceeds it.


    >What would be the best way to do this, and how would I go about doing it? Can it be done simply with the xlwt, xlrd, and xutils modules, or (as I was thinking) do I need to convert the sheets to separate csv files, then append the separate csv files, and then write the completed file back into .xls format? >Or perhaps something else?


    >As I am really only a Python beginner, any and all help is very much appreciated. Thank you in advance!!


    Read the data from the different worksheets using xlrd and then use xlwt to write to a single worksheetin a new excel file. The csv option is probably not useful since it willjust add an intermediary step unless you are converting outside of python (i.e. manually).

    Ramit


    Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
    712 Main Street | Houston, TX 77002
    work phone: 713 - 216 - 5423

    --

    This email is confidential and subject to important disclaimers and
    conditions including on offers for the purchase or sale of
    securities, accuracy and completeness of information, viruses,
    confidentiality, legal privilege, and legal entity disclaimers,
    available at http://www.jpmorgan.com/pages/disclosures/email.
     
    Prasad, Ramit, Feb 16, 2012
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nik
    Replies:
    1
    Views:
    1,270
    ardent.alan
    Mar 21, 2012
  2. Jona
    Replies:
    2
    Views:
    472
    Victor Bazarov
    Jul 6, 2007
  3. Replies:
    1
    Views:
    319
    Mirco Wahab
    Apr 17, 2007
  4. Katja
    Replies:
    1
    Views:
    241
Loading...

Share This Page