Can't figure out how to make this work. I'm basically making a clock in and clock out time sheet. So when they select the check box, it will run a script to clock them in by copying the time over to another column and deleting the checkbox. And another onEdit script that does the same for clocking out. However, both scripts only perform the clocking out action. Here's my code.
function onEdit(e) {
// --------- CLOCKING IN ----------
// Get Range
var sheetName = 'Sheet1'
var cellName = 'D2'
// Set Value False
SpreadsheetApp.getActiveSheet().getRange('D2').setValue('FALSE');
// Move Time
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('G2').activate();
spreadsheet.getRange('B2').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
}
function onEdit(e) {
// --------- CLOCKING OUT ----------
// Get Range
var sheetName = 'Sheet1'
var cellName = 'E2'
// Set Value False
SpreadsheetApp.getActiveSheet().getRange('E2').setValue('FALSE');
// Move Time
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('H2').activate();
spreadsheet.getRange('B2').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
}
And a picture of my Gsheet: