How to use app script to run a google big query and save the results in a new table in the same project folder on google big query
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It will look like this:
function saveQueryToTable() { var projectId = 'your project'; var datasetId = 'your dataset'; var tableId = 'your table'; var job = { configuration: { query: { query: 'SELECT TOP(word, 300) AS word, COUNT(*) AS word_count' + 'FROM publicdata:samples.shakespeare' + 'WHERE LENGTH(word) > 10;', destinationTable: { projectId: projectId, datasetId: datasetId, tableId: tableId } } } }; var queryResults = BigQuery.Jobs.insert(job, projectId); Logger.log(queryResults.status); }
More examples here.