Created
October 24, 2012 06:15
-
-
Save st4lk/3944325 to your computer and use it in GitHub Desktop.
Python: read excel file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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