Python-使用gspread在Google Drive的特定文件夹中创建电子表格

Python-使用gspread在Google Drive的特定文件夹中创建电子表格,python,google-sheets-api,gspread,Python,Google Sheets Api,Gspread,我正在尝试使用gspread创建一个新的电子表格,我希望能够控制它的最终位置 gc = gspread.authorize(credentials) sheetname = 'Test sheet' sheet = gc.create(sheetname) 我认为现在发生的事情是,当我执行gc.create(sheetname)时,它在我的Google服务帐户中创建,但我希望它最终在我的普通帐户中的特定文件夹中 - --算出-- 需要更改为以下内容: if paren

我正在尝试使用gspread创建一个新的电子表格,我希望能够控制它的最终位置

    gc = gspread.authorize(credentials)

    sheetname = 'Test sheet'
    sheet = gc.create(sheetname)
我认为现在发生的事情是,当我执行gc.create(sheetname)时,它在我的Google服务帐户中创建,但我希望它最终在我的普通帐户中的特定文件夹中

-

--算出--

需要更改为以下内容:

if parent_folder_ids:
    body["parents"] = parent_folder_ids
你可以参考这个

请注意,创建的电子表格在驱动器搜索中不会立即可见,您需要通过直接链接访问它。

您可以参考此信息


请注意,创建的电子表格在驱动器搜索中不会立即可见,您需要通过直接链接访问它。

您认为我可以如何使它在驱动器(在我希望它在的文件夹中)中可见?您认为我可以如何使它在驱动器(在我希望它在的文件夹中)中可见?
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.