Skip to content

Instantly share code, notes, and snippets.

@st4lk
Created October 24, 2012 06:15
Show Gist options
  • Save st4lk/3944325 to your computer and use it in GitHub Desktop.
Save st4lk/3944325 to your computer and use it in GitHub Desktop.
Python: read excel file
from xlrd import open_workbook
def is_row_hidden(sheet, row_n):
try:
if sheet.rowinfo_map[row_n].hidden:
return True
except KeyError:
# empty row, treat as hidden
pass
return False
def read_workbook(file_path, sheet_index=0):
rb = open_workbook(file_path, formatting_info=True)
r_sheet = rb.sheet_by_index(sheet_index)
for row in range(r_sheet.nrows):
for col in range(r_sheet.ncols):
print r_sheet.cell_value(row, col)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment