Skip to content

Instantly share code, notes, and snippets.

@tmkasun
Created October 25, 2016 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmkasun/34b16437e2a99ccb6653ad581bdf90a9 to your computer and use it in GitHub Desktop.
Save tmkasun/34b16437e2a99ccb6653ad581bdf90a9 to your computer and use it in GitHub Desktop.
def main():
wb = openpyxl.load_workbook(conf['excel_file'])
name = wb.get_sheet_names()[0]
sheet = wb.get_sheet_by_name(name)
for row in range(2, sheet.max_row): # from 2 (assuming first row contains headers) to end of the rows
condition = sheet.cell(row=row, column=1).value
color = sheet.cell(row=row, column=2).value
year = sheet.cell(row=row, column=3).value
name = sheet.cell(row=row, column=4).value
description = sheet.cell(row=row, column=5).value
body = sheet.cell(row=row, column=6).value
notes = sheet.cell(row=row, column=7).value
json_data = get_json(condition, color, year, name, description, body, notes)
if name:
asset_name = name.replace(" ", "_")
else:
break
create_asset(json_data, asset_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment