在googlesheets中设置清除宏

2024-10-03 15:25:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我期待在谷歌表设置一个宏,我有问题。下面是我的剧本:

function clearRange() {
//replace 'Sheet1'
var sheet1 = SpreadsheetApp.getActive().getSheetByName('Sheet1');
sheet1.getRange('D3:D46').clearContent();
}

下面是我得到的错误:

TypeError: Cannot call method "getRange" of null. (line 4, file "Code")

任何人可以回顾这一点,让我知道我没有看到这里。你知道吗


Tags: varfunctionreplaced3sheet1剧本spreadsheetapp歌表