从私人谷歌电子表格中获取数据

时间:2015-08-20 08:41:57

标签: python google-apps-script google-sheets google-spreadsheet-api

我有一个谷歌电子表格,我与几个人分享。我想构建一个脚本来搜索某些行并获取单元格值,然后在本地处理程序。我正在考虑使用python,因为Google似乎为它提供了一个很好的API。

让某人了解如何连接到Google电子表格?我读了api,但我不知道OAuth 2.0的工作原理是什么......

非常感谢:)

1 个答案:

答案 0 :(得分:0)

要在Google电子表格上执行读写操作,则无需使用OAuth 2.0。对于reading的这些示例以及Google电子表格的writing,为了能够访问SpreadSheet,您必须在代码中包含相关帐户的用户名 - 密码。然后以下列方式使用它们(如编写示例中所示)以访问电子表格:

spr_client = gdata.spreadsheet.service.SpreadsheetsService()
spr_client.email = email
spr_client.password = password
spr_client.source = 'Example Spreadsheet Writing Application'
spr_client.ProgrammaticLogin()

另外,请记住import gdata.spreadsheet.service以及您的代码可能需要的任何其他相关库。如果你是新人,this也是一个好的起点。希望这有帮助!

相关问题