![]() It always starts the paste at A1 of the first worksheet (tab) and deletes all other tabs. I like Burnash's gspread library, but the import_csv function in his answer is limited. the code is tested with python 3.5, but this thread seemed to be most appropriate to submit it to. On a low level gspread does the same and should be as performant. Good thing about directly using batchUpdate is that it uploads thousands of rows in a second. Sheet_id=find_sheet_id_by_name(worksheet_name) With open(path_to_credentials, 'rb') as token:ĪPI = build('sheets', 'v4', credentials=credentials) Request = API.spreadsheets().batchUpdate(spreadsheetId=SPREADSHEET_ID, body=body) "columnIndex": "0", # adapt this if you need different positioning "rowIndex": "0", # adapt this if you need different positioning If sheet = sheet_name:ĭef push_csv_to_gsheet(csv_path, sheet_id): get(spreadsheetId=SPREADSHEET_ID, fields='sheets.properties') \ Path_to_credentials = 'Credentials/token.pickle' SPREADSHEET_ID = '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms' # Get this one from the link in browser Recipe that should work out of the box:įrom googleapiclient.discovery import build.Hopefully by now you have your credentials stored, so let's move to the actual code quickstart.py can easily be adapted into authenticate.py. ![]()
0 Comments
Leave a Reply. |