The flow of my desired program:
- Download the xlsx table to disk (it was created using pandas
to_excel ) - Convert it to Google Sheets.
- Indicate that it is editable by anyone with a link.
- Get a link and share it with whoever will enter information
- Download the completed sheet
I am currently using PyDrive, which solves steps 1 and 5, but there are some unresolved issues.
How can I convert to google listing format? I tried to specify mimeType as 'application/vnd.google-apps.spreadsheet' when I created a file to download from PyDrive, but that gave me an error.
How to set up a file for editing by anyone who has a link? Once this is installed, I can easily get a sharing link with PyDrive.
UPDATE: Switching from xlsx to Google Sheets is easy with the convert=True flag. See below. I'm still looking for a way to set sharing options for my new file so that "someone with a link can edit."
from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive gauth = GoogleAuth() gauth.LocalWebserverAuth() drive = GoogleDrive(gauth) test_file = drive.CreateFile({'title': 'testfile.xlsx'}) test_file.SetContentFile('testfile.xlsx') test_file.Upload({'convert': True})
python google-spreadsheet google-drive-sdk pydrive
djsensei
source share