更新时间:2023-01-21 23:06:13
There is a useful method, called Utilities.parseCsv()
如果您的csv文件位于Google驱动器上,则可以导入和附加该文件,例如通过将具有以下内容的绑定脚本附加到电子表格,
If your csv file is located on your Google drive, you can import and append it e.g. by attaching to your spreadsheet a bound script with the following content:
function appendCSV() {
var file = DriveApp.getFilesByName("PASTE HERE THE NAME OF YOUR CSV FILE INCLUDING EXTENSION").next();
var csvData = Utilities.parseCsv(file.getBlob().getDataAsString(),'SPECIFY HERE THE DELIMITER (OPTIONAL)');
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow=sheet.getLastRow();
sheet.getRange(lastRow, 1, csvData.length, csvData[0].length).setValues(csvData);
}