无法打开 Google xlsx 电子表格/Google Drive 权限也被阻止 [英] Unable to open Google xlsx spreadsheet / Also Google Drive permission Blocked

查看:61
本文介绍了无法打开 Google xlsx 电子表格/Google Drive 权限也被阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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: Service Spreadsheets failed while access with id _____" 与此工作表.这个电子表格实际上是 Google Drive 上的一个 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 Drive 文件访问它.但是现在我收到了一个授权请求,允许我的脚本访问 Google Drive.当我授权时,我得到:

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 帐户,而不是使用公司的应用程序.有什么想法吗?

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.

这篇关于无法打开 Google xlsx 电子表格/Google Drive 权限也被阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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