如何使用 Python 在特定的 Google Drive 文件夹中创建 Google 表单?

问题描述 投票:0回答:1

我无法找到在特定目录中创建 Google 表单的方法。

我创建的所有表单都位于我的 Google 云端硬盘的顶层。

form = {
    "info": {
        "title": "My new form"
    },
}
# Prints the details of the sample form
result = form_service.forms().create(body=form).execute()
print(result)

我尝试添加

parents
关键字,但它没有按预期工作(它未在 Google Forms API 文档中列出)

有办法做到吗?

我只能想到使用在顶层创建的表单id并分配一个新的父目标文件夹id。

我搜索了文档,但找不到在表单创建时指定父文件夹的方法。

python python-3.x google-forms google-api-python-client
1个回答
0
投票

表单Python库没有办法在特定文件夹中创建表单

您可以使用驱动器API来设置文件夹 https://developers.google.com/drive/api/guides/folder#create-file

然后创建表单或任何其他文件

© www.soinside.com 2019 - 2024. All rights reserved.