【发布时间】:2019-03-01 01:33:44
【问题描述】:
所以我对谷歌脚本有点陌生,我不确定我到底做错了什么。我正在尝试将结果从对话框复制到谷歌表格中的单元格。但是,我正在尝试的当前方法不起作用,并且我收到一条回复说“无法在对象(响应)中找到 CopyTo 的函数”
function Cancel() {
var ui = SpreadsheetApp.getUi();
var result = ui.prompt(
'What day did you cancel?',
'Please enter the date as mm/dd/yyy',
ui.ButtonSet.OK_CANCEL);
// Process the user's response.
var button = result.getSelectedButton();
var text = result.getResponseText();
var sheet = SpreadsheetApp.getActiveSheet(),
row = sheet.getLastRow();
if (button == ui.Button.OK) {
// User clicked "OK".
sheet.insertRowAfter(row);
text.copyTo(sheet.getRange(row + 1, 1));
ui.alert('The Date has Been Recorded');
} else if (button == ui.Button.CANCEL) {
// User clicked "Cancel".
ui.alert('I did not get your name.');
} else if (button == ui.Button.CLOSE) {
// User clicked X in the title bar.
ui.alert('You closed the dialog.');
}
}
谁能看看我的代码并就如何将响应复制到单元格提出建议。任何帮助将不胜感激。
【问题讨论】:
标签: google-apps-script copy prompt