【发布时间】:2022-02-16 02:20:05
【问题描述】:
我想为我的谷歌电子表格制作一个脚本,将一系列数据从 sheet1 复制到 Sheet2 中的最后一个空行(a 列)。 我不知道出了什么问题,我得到了这个错误:error 我是编程新手。
【问题讨论】:
标签: javascript google-apps-script google-sheets spreadsheet
我想为我的谷歌电子表格制作一个脚本,将一系列数据从 sheet1 复制到 Sheet2 中的最后一个空行(a 列)。 我不知道出了什么问题,我得到了这个错误:error 我是编程新手。
【问题讨论】:
标签: javascript google-apps-script google-sheets spreadsheet
function copy() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName('Sheet1')
const rg = sh.getActiveRange();//you select the range before running the script
const vs = rg.getValues();
const tsh = ss.getSheetByName('Sheet2');
tsh.getRange(tsh.getLastRow() + 1, 1,vs.length,vs[0].length).setValues(vs);
}
【讨论】: