Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20466 > unrolled thread

Python to Combine Multiple Excel Worksheets into One Worksheet

Started bySMac2347@comcast.net
First post2012-02-15 11:11 -0800
Last post2012-02-16 21:06 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Python to Combine Multiple Excel Worksheets into One Worksheet SMac2347@comcast.net - 2012-02-15 11:11 -0800
    RE: Python to Combine Multiple Excel Worksheets into One Worksheet "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-02-16 21:06 +0000

#20466 — Python to Combine Multiple Excel Worksheets into One Worksheet

FromSMac2347@comcast.net
Date2012-02-15 11:11 -0800
SubjectPython to Combine Multiple Excel Worksheets into One Worksheet
Message-ID<657c4fb5-db56-4bd5-b5a7-112d1d673fbb@d15g2000yqg.googlegroups.com>
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!!

[toc] | [next] | [standalone]


#20524

From"Prasad, Ramit" <ramit.prasad@jpmorgan.com>
Date2012-02-16 21:06 +0000
Message-ID<mailman.5899.1329426408.27778.python-list@python.org>
In reply to#20466
>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!!

Read the data from the different worksheets using xlrd and then use xlwt to write to a single worksheet in a new excel file. The csv option is probably not useful since it will just 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.  

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web