Skip to content

Instantly share code, notes, and snippets.

@Kaundur
Created September 4, 2017 07:53
Show Gist options
  • Save Kaundur/124e5179c16de7d7ef94de0ddaabd250 to your computer and use it in GitHub Desktop.
Save Kaundur/124e5179c16de7d7ef94de0ddaabd250 to your computer and use it in GitHub Desktop.
Simple read of an xlsx file using openpyxl
from openpyxl import load_workbook
workbook = load_workbook('data.xlsx')
sheets = workbook.get_sheet_names()
# Read first sheet
worksheet = workbook.get_sheet_by_name(sheets[0])
for row in worksheet.iter_rows():
for cell in row:
# Print out all values that belong to the cell object
print cell.coordinate, cell.column, cell.row, cell.value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment