I need to add (append) records to a Big Query table from Google Script. I have looked for similar questions and came up with this code (Also I activated the Advanced Service for BigQuery API):
const data = {"Name":"TEST","Key":"TEST"};
var projectId = 'myid'
var datasetId = 'mydatasetid'
var tableId = 'mytableid'
var job = {
configuration: {
load: {
writeDisposition:'WRITE_APPEND',
destinationTable: {
projectId: projectId,
datasetId: datasetId,
tableId: tableId
}
}
}
};
var runJob = BigQuery.Jobs.insert(job, projectId, data);
I get an error: "The mediaData parameter only supports Blob types for upload."
I know I could use this method to add data from a CSV file, but I would like to add an array instead. Is it possible?