Skip to content

Instantly share code, notes, and snippets.

@yosemitebandit
Created June 4, 2012 17:42
Show Gist options
  • Save yosemitebandit/2869767 to your computer and use it in GitHub Desktop.
Save yosemitebandit/2869767 to your computer and use it in GitHub Desktop.
reading xlsx files in python with openpyxl
$ pip install -E ~/conf/virtualenvs/xyuml https://bitbucket.org/ericgazoni/openpyxl/get/1.5.8.zip
from openpyxl import load_workbook
workbook = load_workbook('/tmp/data.xlsx', use_iterators=True)
first_sheet = workbook.get_sheet_names()[0]
worksheet = workbook.get_sheet_by_name(first_sheet)
for row in worksheet.iter_rows():
print row
# check out the last row
for cell in row:
print cell
@danching
Copy link

use_iterators has been changed to read_only=True

@theepag
Copy link

theepag commented Oct 26, 2022

I can't able to open an excel sheet with comments. What is the solution for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment