无法打开Goog​​le xlsx电子表格/还禁用了Google云端硬盘权限 [英] Unable to open Google xlsx spreadsheet / Also Google Drive permission Blocked

查看:147
本文介绍了无法打开Goog​​le xlsx电子表格/还禁用了Google云端硬盘权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Google Apps脚本,目前正在使用它成功打开Goog​​le表格电子表格(与我的帐户只读共享)并执行一些阅读功能.

I have a Google Apps Script that I am currently using to successfully open a Google Sheets spreadsheet (read-only shared with my account) and perform some reading functions.

我收到了另一个电子表格,希望对其进行类似的处理.如果我尝试: SpreadsheetApp.openById("_______")(在另一张工作表上有效),我得到 Exception:服务电子表格在访问此工作表的ID为_____"的文档时失败.该电子表格实际上是Google云端硬盘上的xlsx(但看起来它仍然可以在Google表格中打开),而不是原生Google表格,因此我认为这可能是问题所在……?

I received another spreadsheet that I would like to run similar processes on. If I try: SpreadsheetApp.openById("_______") (which works on the other sheet), I get Exception: Service Spreadsheets failed while accessing document with id _____" with this sheet. This spreadsheet is actually an xlsx on Google Drive (but appears it can still open in Google sheets) rather than a native Google sheet so I figured maybe that was the issue...?

所以现在我正尝试使用 DriveApp.getFileById("____")将其作为Google云端硬盘文件进行访问.但是,现在我收到一个授权请求,以允许我的脚本访问Google云端硬盘.授权后,我会得到:

So now I'm trying to instead access it as a Google Drive file using DriveApp.getFileById("____"). However now I get an authorization request to allow my script to access Google Drive. When I authorize it, I get:

此应用已被阻止
该应用尝试访问您Google帐户中的敏感信息.为了确保您帐户的安全,Google阻止了此访问.

This app is blocked
This app tried to access sensitive info in your Google Account. To keep your account safe, Google blocked this access.

我还没有找到解决此问题的方法.我使用的是Google私人帐户,而不是使用公司的Apps.有什么想法吗?

I haven't found a way to fix this. I'm on a private Google account, not using a company's Apps. Any ideas?

推荐答案

找到了权限问题的解决方案.

Found a solution to the permission issue.

要使用Apps脚本,我已经从@alper的解决方案中修改了此内容,该解决方案源自@tellowkrinkle的评论.

To work with Apps Script, I've modified this from @alper's solution which sources @tellowkrinkle's comment.

执行以下操作:

  1. 转到 https://console.developers.google.com 并为自己创建一个新项目
  2. 在顶部的搜索框中搜索Google Drive API,然后将其打开
  3. 单击左侧的OAuth同意屏幕并进行设置.
    • 假设您的帐户不是组织的一部分,则必须说您的应用程序适用于外部用户并正在测试中
    • 在必需的作用域"部分中,添加.../auth/docs和.../auth/drive(我不确定哪个需要,可能只是其中之一).如果您没有完成(2),则可能无法使用此功能
    • 将要与gdrive副本一起使用的帐户添加为应用的测试人员.只有这些帐户才能使用您的gdrive副本,因此每个人都必须自己编译(除非有人去接受Google审核).我只添加了自己的帐户,因为我是唯一使用使用我的云端硬盘的应用脚本的人.
  1. Go to https://console.developers.google.com and create a new project for yourself
  2. Search for the Google Drive API in the search box at the top, and turn it on
  3. Click OAuth consent screen on the left and set it up.
    • Assuming your account isn't part of an organization, you'll have to say your app is for external users and in testing
    • In the required scopes section, add .../auth/docs and .../auth/drive (I'm not sure which needed, it's probably only one of those). This will probably not be available if you didn't complete (2)
    • Add the accounts you want to use with your copy of gdrive as testers of your app. Only these accounts will be able to use your copy of gdrive, so everyone will have to compile their own (unless someone goes and gets theirs reviewed by Google). I only added my own account because I am the only one using my App Script which uses my Drive.

这篇关于无法打开Goog​​le xlsx电子表格/还禁用了Google云端硬盘权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆