[英]Google Apps Script: Copy and paste selected cell to another sheet, then delete from source
I am completely new to google apps script - any help is appreciated!我对谷歌应用程序脚本完全陌生 - 感谢任何帮助!
I have a spreadsheet called Dismissal.我有一个名为 Dismissal 的电子表格。 On this spreadsheet, there is a tab called "Student Names" and another called "Check Out".在这个电子表格上,有一个名为“学生姓名”的选项卡和另一个名为“结帐”的选项卡。 I am wondering if there is a script to copy whichever cell is selected from the Student Names tab and paste it to the first empty row in column A of the Check Out tab - and then delete the cell from the source (the Student Names tab), or at least clear the contents of the cell on the source.我想知道是否有一个脚本可以复制从“学生姓名”选项卡中选择的任何单元格并将其粘贴到“签出”选项卡的 A 列中的第一个空行 - 然后从源中删除该单元格(“学生姓名”选项卡) ,或者至少清除源上单元格的内容。
Please let me know if you need any more details.如果您需要更多详细信息,请告诉我。 Thank you so much --太感谢了 -
function copyNameToCheckOut() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName("Student Names");
const dsh = ss.getSheetByName("Check Out");
sh.getActiveCell().copyTo(dsh.getRange(dsh.getLastRow() + 1, 1));
sh.getActiveCell().clearContent();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.