Вы можете добавить листы двумя способами:
Ниже у вас есть фрагмент, демонстрирующий оба и работающий на моем ПК (python 3.6)
import os
import pickle
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
SCOPES = ['https://www.googleapis.com/auth/spreadsheets', ]
if not os.path.exists('credentials.dat'):
flow = InstalledAppFlow.from_client_secrets_file('client_id.json', SCOPES)
credentials = flow.run_local_server()
with open('credentials.dat', 'wb') as credentials_dat:
pickle.dump(credentials, credentials_dat)
else:
with open('credentials.dat', 'rb') as credentials_dat:
credentials = pickle.load(credentials_dat)
if credentials.expired:
credentials.refresh(Request())
spreadsheet_sdk = build('sheets', 'v4', credentials=credentials)
# we create a new sheet at creation time of the spreadsheet
create_body = {
'properties': {
'title': 'Newly created sheet',
'locale': 'en_US',
},
'sheets': [
{
'properties': {
'sheetId': 0,
'title': "Created at creation time",
'index': 0,
'sheetType': 'GRID',
'gridProperties': {
'rowCount': 2,
'columnCount': 2,
},
},
}
]
}
new_google_spreadsheet = spreadsheet_sdk.spreadsheets().create(body=create_body).execute()
# we add a sheet to an existing spreadsheet
add_sheet_params = {
'spreadsheetId': new_google_spreadsheet['spreadsheetId'],
'body': {
'requests': [
{
'addSheet': {
'properties': {
'sheetId': 1,
'title': "Added later",
'index': 0,
'sheetType': 'GRID',
'gridProperties': {
'rowCount': 2,
'columnCount': 2,
},
}
}
}
],
'includeSpreadsheetInResponse': False
}
}
new_sheet_add = spreadsheet_sdk.spreadsheets().batchUpdate(**add_sheet_params).execute()
print(new_sheet_add)