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?
google-apps-script gsuite
goose
source share