Project {project-id} not found and cannot be used for API calls

I have a Google Appscript that calls the Big Query API. It works fine, but I want to duplicate the sheet and use it for a different set of reports. I duplicated the file once successfully a couple of months ago.

Now when you duplicate the report and authenticate using the Big Query API, I get the following error:

"The project {project-id-different-to-below} was not found and cannot be used for API calls (line 16, file" reportModel ")"

I do not recognize the project identifier in the message, this is not the same as what I wrote in my code. In addition, before I authenticated the API while trying to use it, the error message linked me to the corresponding console page to enable the use of the API, it no longer does this.

This is an important piece of code:

var projectId = '{project-id}'; var request = { query: sql_code, useLegacySql : false }; var queryResults = BigQuery.Jobs.query(request, projectId); 

Why is this happening and how can I authenticate a new Google sheet file using the API? In addition, why is the project identifier indicated in the error message different from the one indicated in the code?

+9
google-apps-script gsuite
source share
2 answers

I managed to solve it now, and I did it by clicking "Resources-> Google Advanced Services". This had a link to the Google API Console, if you follow it, the console will have the correct project, and you can enable the Big Query API.

I could not find another way to choose the right project, although I am sure that there is one.

+3
source share

Go to https://script.google.com/home/usersettings and enable the "Google Apps Script API".

0
source share