Google Apps Script: Copy and paste selected cell to another sheet, then delete from source

Viewed 30

I am completely new to google apps script - any help is appreciated!

I have a spreadsheet called 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.

Please let me know if you need any more details. Thank you so much --

1 Answers

Copy Student Name to Check Out

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();
}
Related