I am trying to trigger another function after 2 of Big Query tables are refreshed hence I trying to refresh all my connected datasets in a google sheet by using an app script code. Both of my tables come from different datasets but the permission of both the datasets is the same on Big Query. When I'm running the code, only one set is being refreshed while the other is throwing an "You do not have access to the connected BigQuery table" error where I'm the owner of the table itself. While I try to refresh all the sheets manually using refresh all button all sheets are refreshing rightly. I'm new to BigQuery so please help me out how I can fix the same.
The following code is what I'm using but it seems to be working fine only for one table not for the another. `
function BigQueryRefresh() {
var sheet = SpreadsheetApp.getActive();
SpreadsheetApp.enableAllDataSourcesExecution();
sheet.refreshAllDataSources();
ScriptApp.newTrigger("myFunction")
.timeBased()
.after(60*1000) // Time is sec * conversion
.create();
}
` This is the error which I'm getting even though I'm the owner of the table:
You do not have access to the connected BigQuery table. The required permission is: "bigquery.tables.getData". Learn how to fix permission issues
Contact the table's owner or your admin to request access.
To view this query, visit BigQuery. If you do not have access, then relay the following Job ID to someone who has access: {Job ID}