问题描述
我有一个叫做Big Query API的google appscript。它工作正常,但我想复制工作表并用于不同的报告集。我已经在几个月前成功复制了该文件。
I have a google appscript that calls the Big Query API. It's working fine, but I want to duplicate the sheet and use for a different set of reports. I've duplicated the file once successfully a couple of months ago.
现在,当复制报表并使用Big Query API进行身份验证时,出现以下错误:
Now when duplicating the report and authenticating with the Big Query API I get the following error:
Project {project-id-different-to-below}找不到,不能用于API调用(第16行,文件reportModel)
"Project {project-id-different-to-below} is not found and cannot be used for API calls. (line 16, file "reportModel")"
我无法识别邮件中的项目ID,它与写入我的代码中的项目ID不同。另外,在我尝试使用API验证API之前,错误消息将我链接到相关的控制台页面以启用API,因此不再执行此操作。
I don't recognise the project id in the message, it's not the same as the one written into my code. Also before when I authenticated the API by trying to use it, the error message linked me to the relevant console page to enable use of the API, it no longer does this.
这是代码的相关部分:
var projectId = '{project-id}';
var request = {
query: sql_code,
useLegacySql : false
};
var queryResults = BigQuery.Jobs.query(request, projectId);
为什么会发生这种情况,以及如何使用API验证新的Google表单文件?此外,为什么错误消息中列出的项目ID与代码中写入的项目ID不同?
Why is this happening and how can I authenticate the new google sheet file with the API? Also, why is the project id listed in the error message different to the one written in the code?
推荐答案
我已设法现在解决这个问题,我点击了资源 - >高级Google服务。这有一个链接到'谷歌API控制台',如果你按照它的控制台将选择正确的项目,你可以启用大查询API。
I have managed to resolve this now and I did so by clicking 'Resources->Advanced Google Services'. This had a link to the 'Google API Console', if you follow it the console will have the correct project selected and you can enable the Big Query API.
我couldn找不到另一种方式来选择正确的项目,但我确信有一个。
I couldn't find another way to get the correct project selected, although I'm sure there is one.
这篇关于未找到Project {project-id},无法用于API调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!