I'm trying to create a new spreadsheet using gspread, and I want to be able to control where it ends up.
gc = gspread.authorize(credentials)
sheetname = 'Test sheet'
sheet = gc.create(sheetname)
I think that what's happening is that when I do gc.create(sheetname), it's making it in my Google service account, but I want it to end up in a specific folder in my normal account.
-
--Figured it out--
Needed to change to the following:
if parent_folder_ids:
body["parents"] = parent_folder_ids
You may refer with this tutorial.
def create_google_spreadsheet(title: str, parent_folder_ids: list=None, share_domains: list=None) -> Spreadsheet:
"""Create a new spreadsheet and open gspread object for it.
Be noted that created spreadsheet is not instantly visible in your Drive search and you need to access it by direct link.