1 PUZZLE_TEMPLATE_ID = "1drSoyrE4gM3JaGweDkOybwXWdKPIDTfUmB1gQCYS3Uw"
2 PUZZLE_TEMPLATE_SHEETS = ["Text", "Grid"]
4 def sheets_create(turb, name):
5 """Create a new sheet with the given name.
7 Returns the dict with 'id' and 'url'of the spreadsheet.
10 # Create a new spreadsheet
17 new_sheet = turb.sheets.create(body=spreadsheet_body).execute()
20 'id': new_sheet["spreadsheetId"],
21 'url': new_sheet["spreadsheetUrl"]
24 def sheets_create_for_puzzle(turb, name):
25 """Creates a new sheet for a puzzle of the given name
27 Like sheets_create(), but also copies the puzzle template sheet."""
29 # First create the new sheet
30 new_sheet = sheets_create(turb, name)
32 # Copy some sheets from the Template spreadsheet
34 response = turb.sheets.get(spreadsheetId=PUZZLE_TEMPLATE_ID).execute()
36 for sheet in response["sheets"]:
37 if sheet["properties"]["title"] in PUZZLE_TEMPLATE_SHEETS:
38 turb.sheets.sheets().copyTo(spreadsheetId=PUZZLE_TEMPLATE_ID,
39 sheetId=sheet["properties"]["sheetId"],
41 "destinationSpreadsheetId":