Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56925
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <john.mathew.python@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.029 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'element': 0.07; 'sys': 0.07; 'expectation': 0.09; 'subject:into': 0.09; '#create': 0.16; '3):': 0.16; 'idx,': 0.16; 'xlrd': 0.16; 'help.': 0.21; '8bit%:5': 0.22; 'import': 0.22; 'merge': 0.24; 'fine': 0.24; 'values': 0.27; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'common': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'subject:one': 0.36; 'somebody': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:x 10': 0.40; 'more': 0.64; 'different': 0.65; 'column.': 0.84; 'subject:common': 0.84; 'sheet': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=SgGJ15ixNIUUYhGyt9sZQGdEoBLtuymssOI6W46aFNQ=; b=M6ukRHtwjwxON5IPgQYZZDz3Ij8IP+MvH0lvgWhJeKEeWvQ7xl4E+jmNc2NOCRcPLu /ucPtz2kN3R69GUkP4Wrp36qlSCgyfRVa1hxaLh5pQO5cLkJ7JXHa3TotdmaQWs3WrPW VjbRgOShx+jzcIj1aE1oJO0q41TMVGku63SEK8drlDYE1V4kKcdMQkgR1hrhi3TFoaHh A6HrxIde92UFHfnMbVp1s/3MCNda59scY2LQ++t8A5wP/rS0T38C3GfsCkAahuhlgxSu WB3XvQZ0S08J5r+nLg4XPb8jMz/VYcE8dCrvyDcHNZ3+i+7FZr32nnPM+GzbDFdm1xzR L4Jw== |
| MIME-Version | 1.0 |
| X-Received | by 10.14.113.137 with SMTP id a9mr8366292eeh.3.1381966123253; Wed, 16 Oct 2013 16:28:43 -0700 (PDT) |
| Date | Wed, 16 Oct 2013 16:28:43 -0700 |
| Subject | Merging xls into a common one |
| From | John Mathew <john.mathew.python@gmail.com> |
| To | python-list@python.org |
| Content-Type | multipart/alternative; boundary=001a1133a718de631904e8e40f4e |
| X-Mailman-Approved-At | Thu, 17 Oct 2013 03:16:17 +0200 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1140.1381972578.18130.python-list@python.org> (permalink) |
| Lines | 48 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1381972578 news.xs4all.nl 15884 [2001:888:2000:d::a6]:40588 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:56925 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
This code works fine when there are xls in which Row has One column, but
not when Row has more column.
The expectation is to merge the different xls into a common one.
Can somebody please help.
import xlwt
import xlrd
import sys
#Create workbook and worksheet
wbk = xlwt.Workbook()
dest_sheet = wbk.add_sheet('Data_1')
for sheet_idx in range(1, 3):
sheet = xlrd.open_workbook('Data_%d.xls' % sheet_idx).sheet_by_index(0)
for i in range(5):
values = sheet.row_values(i)
for idx, element in enumerate(values):
dest_sheet.write(i, sheet_idx+idx, element)
wbk.save('DATA.xls')
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Merging xls into a common one John Mathew <john.mathew.python@gmail.com> - 2013-10-16 16:28 -0700
csiph-web