【问题标题】:Google Spreadsheet Secure Client Email Sharing?谷歌电子表格安全客户电子邮件共享?
【发布时间】:2015-06-04 02:51:26
【问题描述】:

我目前正在使用 Gspread python 库将数据写入谷歌电子表格。但是,谷歌电子表格是安全的,我无法共享客户端电子邮件以将数据写入电子表格。有没有办法从我的 python 脚本中写入数据?我无法更改配置以使其可与任何东西共享。

【问题讨论】:

  • 在下面的答案中查看我的评论。
  • “谷歌电子表格是安全的”是什么意思,是“两步验证”吗?还有“分享客户邮箱”怎么分享?

标签: python google-api google-drive-api google-spreadsheet-api gspread


【解决方案1】:

范围:spreadsheets.google.com/feeds/电子邮件范围不是必需的

例如

   scopes = ["https://spreadsheets.google.com/feeds/"]

听起来像是 OAuth2 问题 - 建议您列出您正在使用的 OAuth 2 范围设置,但我认为电子邮件不是必需的

我认为大多数示例都倾向于包含它,但不认为它是必需的。这个例子是python,可能对你有帮助,但它确实包括电子邮件https://github.com/eddyparkinson/gridspree

它有:

def login(force=True):
    next = request.args.get('next') or settings.SERVICE_URL
    scopes = ["https://spreadsheets.google.com/feeds/",
              "https://www.googleapis.com/auth/plus.me",
              "https://www.googleapis.com/auth/userinfo.email",
              "https://www.googleapis.com/auth/drive.readonly"]
    params = {
        'response_type':'code',
        'access_type':'offline',
        'state': next
    }

    if force:
        params.update(approval_prompt='force')

    authorization_url = get_auth_url(' '.join(scopes), **params)

【讨论】:

  • 问题非常不清楚,但我怀疑他的意思。通过电子邮件我认为他是指他用来登录他的应用程序的谷歌电子邮件帐户。电子表格只与他共享。
  • @ZigMandel 公平评论 - 这个问题有几点不清楚。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-01-07
  • 1970-01-01
  • 1970-01-01
  • 2021-06-29
  • 1970-01-01
相关资源
最近更新 更多