daily pastebin goal
40%
SHARE
TWEET

Untitled

a guest Jan 17th, 2018 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def XLSXDictReader(f):
  2.     book = openpyxl.reader.excel.load_workbook(f)
  3.     sheet = book.get_active_sheet()
  4.     rows = sheet.max_row
  5.     cols = sheet.max_column
  6.     headers = dict((i, sheet.cell(row=1, column=i).value) for i in range(1, cols))
  7.     def item(i, j):
  8.         return (sheet.cell(row=1, column=j).value, sheet.cell(row=i, column=j).value)
  9.     return (dict(item(i, j) for j in range(1, cols + 1)) for i in range(2, rows + 1))
RAW Paste Data
Top