코드를 실행할 때 위의 예외가 발생했습니다. 주석 기가 제안예외 : 누락) for 루프 제어
// this function assumes the CSV has no fields with commas, // and strips out all the double quotes function parseCsvResponse(csvString) { var retArray = []; var strLines = csvString.split(/\n/g); var strLineLen = strLines.length; for (var i = 0; i < strLineLen; i++) { var line = strLines[i]; if (line != '') { retArray.push(line.replace(/"/g, "").split(/,/)); } } return retArray; } function populateSheetWithCSV(sheet, csvUrl, user, pw) { // request the CSV! var resp = UrlFetchApp.fetch(csvUrl, { headers: { // use basic auth 'Authorization': 'Basic ' + Utilities.base64Encode(user + ':' + pw, Utilities.Charset.UTF_8) } });
// parse the response as a CSV
var csvContent = parseCsvResponse(resp.getContentText());
// clear everything in the sheet
sheet.clearContents().clearFormats();
// set the values in the sheet (as efficiently as we know how)
sheet.getRange(1, 1, csvContent.length /* rows */, csvContent[0].length /* columns */).setValues(csvContent);
}
견적 문자는 쌍으로 입력해야합니다. – starbolin
그건 그렇고,'Utilities.parseCsv' 함수가 있습니다. 스스로 개발할 필요가 없습니다. –