Javascript Google Bigquery的应用程序脚本未知错误
CSThis应该读入一个,然后将其写入bigquery。但是,当它运行时,不会写入任何内容,也不会记录任何错误。我读到我需要写一个csv,然后把它转换成八位字节流。我不确定这是否与google bigquery兼容。我还尝试删除setSourceURI,但仍然没有发现任何错误Javascript Google Bigquery的应用程序脚本未知错误,javascript,google-apps-script,google-bigquery,Javascript,Google Apps Script,Google Bigquery,CSThis应该读入一个,然后将其写入bigquery。但是,当它运行时,不会写入任何内容,也不会记录任何错误。我读到我需要写一个csv,然后把它转换成八位字节流。我不确定这是否与google bigquery兼容。我还尝试删除setSourceURI,但仍然没有发现任何错误 function test(){ try{ var tableReference = BigQuery.newTableReference(); tableReference.setProjectId(PROJECT_
function test(){
try{
var tableReference = BigQuery.newTableReference();
tableReference.setProjectId(PROJECT_ID);
tableReference.setDatasetId(datasetId);
tableReference.setTableId(tableId);
var schema = "CUSTOMER:string, CLASSNUM:integer, CLASSDESC:string, CSR:string, CSR2:string, INSURANCE:string, REFERRALGENERAL:string, REFERRALSPECIFIC:string, NOTES:string, INMIN:integer, INHR:integer, OUTMIN:integer, OUTHR:integer, WAITMIN:integer, WAITHR:integer, DATETIMESTAMP:float, DATEYR:integer,DATEMONTH:integer, DATEDAY:integer";
var load = BigQuery.newJobConfigurationLoad();
load.setDestinationTable(tableReference);
load.setSourceUris(URIs);
load.setSourceFormat('CSV');
load.setSchema(schema);
load.setMaxBadRecords(0);
load.setWriteDisposition('WRITE_TRUNCATE');
var configuration = BigQuery.newJobConfiguration();
configuration.setLoad(load);
var newJob = BigQuery.newJob();
newJob.setConfiguration(configuration);
var loadr = DriveApp.getFilesByName("test.csv");
var x = loadr.next().getBlob();
Logger.log(x.getDataAsString());
var d = DriveApp.getFilesByName("test.csv");
var id = d.next().getId();
Logger.log(id);
var data = DocsList.getFileById(id).getBlob().getDataAsString();
var mediaData = Utilities.newBlob(data, 'application/octet-stream');
BigQuery.Jobs.insert(newJob, PROJECT_ID, mediaData)
}
catch(error){Logger.log("A" + error.message);}
}
应用程序脚本文档包含一些示例代码,说明如何将CSV加载到bigquery中:为什么CSV文件使用换行符分隔的JSON源格式?我将其更改为CSV,但它要求的URI我找不到。目前,我正在做gs://project\u name