pyExcelerator - Can I read and modify an existing Excel-WorkBook?



Yes indeed, pyExcelerator does support reading data from excel spreadsheets. An example of how to do this is included in the file xls2csv-gerry.py under the directory ... pyExcelerator/examples/tools Syntax is pretty straight forward. extract_all = parse_xls(filename, CP = None) where CP is the encoding format used within tht file. Uses same codes that xlrd uses, ie 'cp437' = US English.

All you need is the "parse_xls" command and simply let it iterate through your spread*** file.
EXAMPLE:

fname = "D:\\Directory\\myfile.xls" # an example filename
for sheet_name, values in parse_xls(fname ): # parse_xls(arg) -- default encoding
print " name of sheet is = ", sheet_name,

Alternatively you can extract everything in one go...

extract_all = parse_xls(fname)

.


Quantcast