是否可以使用 Python 和 gdata.spreadsheet 创建 Google 表格数据验证规则?

Is it possible to create Google Sheets data validation rules using Python and gdata.spreadsheet?

我能够获取单元格内容,但验证规则似乎无法访问。我有基于此的工作代码:

https://github.com/google/gdata-python-client

Apps 脚本似乎可以做到:

https://developers.google.com/apps-script/guides/sheets

如果可能,我更愿意在 Python 中执行此操作。

想法?

谢谢,

-dj

从 Google Sheets API v4 开始,这是可以做到的。下面简单介绍一下新版本:

http://wescpy.blogspot.com/2016/06/using-new-google-sheets-api.html

以下是有关如何以编程方式创建验证的一些详细信息:

https://developers.google.com/sheets/samples/data#apply_data_validation_to_a_range

我已经使用 google-api-python-client 1.5.1

验证它在 Python 中有效