Getting My Output Into Another Excel File
Solution 1:
I am not familiar myself with xlrd
or any of the other modules, but doing any work with csv or excel spreadsheets, I use Pandas, specifically this link. It allows you to easily read and make all sorts of modifications, and then write it out very easily as well. If all you wanted was to copy it would be really easy.
Solution 2:
The problem you've got is that row
is an integer, as it's populated using for row in range(1, rs.nrows):
where the range()
function returns an integer - In your case what I presume is each row number between 1 and the number of rows in your spreadsheet.
I'm not familiar with how the xlrd
, xlutils
and xlwt
modules work, but I'd imagine you want to do something more like the following:
for row_number inrange(1, rs.nrows):
row= rs.row(row_number)
for cell inrow:
....
The Sheet.row(rowx)
method gives you a sequence of Cell
objects that you can iterate in your inner loop.
Post a Comment for "Getting My Output Into Another Excel File"