0

I'm looking to copy an sheet to another spreadheet but I would like to include the script function assigned to the button I include it.

Is there a way?

The function I'm using to copy is:

function sheetCopy(){
 var source = SpreadsheetApp.getActiveSpreadsheet();
 var sheet = source.getSheets()[0];
 var destination = SpreadsheetApp.openById("ID_GOES HERE");
 sheet.copyTo(destination);
}

And the sheet has a button with a copy/paste script.

Rubén
  • 34,714
  • 9
  • 70
  • 166
  • No, you can't copy the code. The code is attached to the source spreadsheet file. You can only copy the original spreadsheet file. – Marios Mar 03 '21 at 00:40
  • What do you exactly mean by "include the script function attached to the button"? Which button? @Mario is right in his comment – Raserhin Mar 03 '21 at 16:37
  • @Raserhin I placed a button on a spreadsheet that runs a script, so I was wondering if when copying the sheet if there could be a way to copy the script linked to the button in it. Im adding a new sheet with a script to a report but I want to copy this new sheet to previous versions, I'm able to copy the sheet but it doesn't copy the Script that I need. – Juan Pablo Marroquin Ocampo Mar 03 '21 at 22:05

0 Answers0