BigQuery:未找到具有Google云端硬盘范围的OAuth令牌 [英] BigQuery: No OAuth token with Google Drive scope was found

查看:95
本文介绍了BigQuery:未找到具有Google云端硬盘范围的OAuth令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用BigQuery查询替换Google表格的内容.

I'm trying to replace the contents of a Google Sheet with a BigQuery query.

我在Google表格中,并使用基于以下内容的脚本:使用Google Spreadsheet访问BigQuery

I'm in the Google Sheet and using a script based on these: https://greenido.wordpress.com/2013/12/16/big-query-and-google-spreadsheet-intergration/ Accessing BigQuery with Google Spreadsheet

脚本执行的所有操作是从BigQuery查询中提取信息并将其写入Google表格.但是,如果我只运行脚本,最终会得到一个错误: BigQuery:找不到带有Google云端硬盘范围的OAuth令牌

All the script does is pull the info from a BigQuery query and write it to a Google Sheet. But if I just run the script, I end up getting an error: BigQuery: No OAuth token with Google Drive scope was found

要使它正常工作,我需要做什么?

What do I need to do to get this to work?

推荐答案

经过大量的Google搜索,我找到了答案.显然,即使我需要赋予我的脚本权限来管理不仅我的Google表格,而且还具有管理我的Google云端硬盘的权限.

After a lot of Googling, I found the answer. Apparently, even though I need to give my script the authority to manage not just my Google Sheet, but also the authority to manage my Google Drive.

我所要做的就是添加一个功能,使Google要求我许可脚本来管理我的云端硬盘.

All I have to do is add a function to make Google ask me for permission for the script to manage my Drive.

功能如下:

function usingAppsScriptsToken ()}
  // we need to provoke a drive dialog
  // DriveApp.getFiles()
}

请注意,关键成分是DriveApp.getFiles(),即使已注释,它仍然有效.当我运行该功能时,会弹出一个窗口,显示(您的脚本)希望查看和管理Google云端硬盘中的文件".如果允许,数据导入功能将起作用.

Note that key ingredient is DriveApp.getFiles(), and it still works even though it's commented. When I run the function, I'll get a pop-up window that says "(your script) would like to View and manage the files in your Google Drive". When I allow it, the data import function works.

来源

这篇关于BigQuery:未找到具有Google云端硬盘范围的OAuth令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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