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.
Now when duplicating the report and authenticating with the Big Query API I get the following error:
"Project {project-id-different-to-below} is not found and cannot be used for API calls. (line 16, file "reportModel")"
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.
This is the relevant part of the 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 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?
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.
I couldn't find another way to get the correct project selected, although I'm sure there is one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With