I am a new Sheets, I have checked other responses on this, but I suck at coding and broke the script each time I did it – it stopped running.
Essentially, I want to add a trigger based on a checkbox in sheets to execute the script below. This copy and paste a new “project” set of cells below and ideally repeats each time the box would be ticked. I plan on having another macro run that removes completed projects to a different worksheet, but I have yet to develop this.
What can I add to get this to work via a checkbox in the sheet?
function Addproject() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('B34').activate();
spreadsheet.getRange('B29:L33').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
};
function UntitledMacro() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getRange('B2').activate();
spreadsheet.getCurrentCell().setValue('TRUE');
spreadsheet.getRange('B39').activate();
spreadsheet.getRange('B34:P38').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
};
function Addproject1() {
var spreadsheet = SpreadsheetApp.getActive();
spreadsheet.getCurrentCell().offset(0, -2).activate();
spreadsheet.getCurrentCell().offset(-5, 0, 5, 16).copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
};
2