0

I want to copy/paste the values of a specific column into the next column using a trigger at a certain time of the day. The script works when I run it manually, it runs as per 'last run' via trigger but it actually does not copy/paste the values via the trigger (only when I run it manually). Here is the script:

function eoddata() {
  var spreadsheet = SpreadsheetApp.getActive();
  var targetCell=spreadsheet.getRange('C1');
  spreadsheet.getRange('B1:B43').copyTo(targetCell, SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
};

It used to run via trigger but I kept amending the sheet & script. How can I get this trigger to actually do copy/paste the values again pls?

1
  • The Range.copyTo() method accepts any range reference and only looks at the top-left cell of the target. Commented Oct 14, 2021 at 21:29

1 Answer 1

1

One potential issue is that the range references in the code do not specify a sheet name. When the function is run through an installable trigger, it will default to the first tab in the spreadsheet, rather than the tab the user at the keyboard has open at the time.

To make it work on another sheet, you need to specify a sheet name in the range references.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.