I am trying to extract an existing BigQuery table to a Cloud Storage bucket using Apps Script because I need to schedule it for frequent runs. The Cloud set up (billing, api enabled) is complete and when I extract the table via the Web UI it all works fine.
Please help me with the Apps Script code. Below you can see what I am writing. It works with no error messages but it does not create the json file in Storage.
function SQLTest() {
var projectId = 'xx_my_project';
var datasetId = 'xx_my_dataset';
var tableId = 'xx_my_table';
var destinationUris = 'gs://my_bucket/my_file.json';
var destinationFormat = 'NEWLINE_DELIMITED_JSON';
var job = {
configuration: {
extract: {
sourceTable: {
projectId: projectId,
datasetId: datasetId,
tableId: tableId
}
,
destinationUris: [destinationUris],
destinationFormat: destinationFormat
}
}
}
} ;