Python to Combine Multiple Excel Worksheets into One Worksheet

S

SMac2347

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!!
 
P

Prasad, Ramit

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,965
Messages
2,570,148
Members
46,710
Latest member
FredricRen

Latest Threads

Top