Question posted 2012 · +6 upvotes
I don’t think there is something wrong with the codes. Can you help me? I need help. Thank you!
from xlrd import open_workbook
wb = open_workbook('/pdf-ex/exc.xlsx','rb')
for s in wb.sheets():
print 'Sheet:',s.name
for row in range(s.nrows):
values=[]
for col in range(s.ncols):
values.append(s.cell(row,col).value)
print ",".join(values)
print
Accepted answer +7 upvotes
I had the same problem and resolved it by upgrading to version 0.8.0.
Prior to that version, xlsx/xlsm were not supported.
Release announcement: http://mail.python.org/pipermail/python-list/2012-August/627757.html
Latest version: https://pypi.python.org/pypi/xlrd/
External references cited (2)
- mail.python.org — http://mail.python.org/pipermail/python-list/2012-August/627757.html
- pypi.python.org — https://pypi.python.org/pypi/xlrd/
Top excel Q&A (6)
- Shortcut to Apply a Formula to an Entire Column in Excel +335 (2011)
- How should I escape commas and speech marks in CSV files so they work in Excel? +136 (2012)
- Convert xlsx to csv in linux command line +96 (2012)
- How to create a link inside a cell using EPPlus +50 (2011)
- IF statement: how to leave cell blank if condition is false ("" does not work) +44 (2013)
- T-SQL: Export to new Excel file +44 (2012)
excel solutions on this site
.