Friday, 15 March 2013

python - Going down columns using xlrd -



python - Going down columns using xlrd -

let's have cell (9,3). want values (9,3) (9,99). how go downwards columns values. trying write values excel file starts (13, 3) , ends @ (13,99). how write loop in xlrd?

def write_into_cols_rows(r, c): num in range (0,96): c += 1 homecoming (r,c)

worksheet.row(int) homecoming row, , value of columns, need run row[int].value value.

for more information, can read this pdf file (page 9 introspecting sheet).

import xlrd workbook = xlrd.open_workbook(filename) # first sheet in workbook. worksheet = workbook.sheet_by_name(workbook.sheet_names()[0]) index in range(worksheet.nrows): try: row = worksheet.row(index) row_value = [col.value col in row] # row_value list contains column values print row_value[3:99] except: pass

to write info excel file, might want check out xlwt package.

btw, seems doing reading excel.. work... write excel... recommend take @ numpy, scipy or r. when info munging, utilize r , saves me much time.

python loops xlrd

No comments:

Post a Comment