0

I need help. I'm trying to make a backup of my worksheet that makes it take the data from the worksheet and put it in another worksheet but it's giving this error!

enter image description here

Z87
  • 1
  • Try enclosing the upper script into a function declaration. Your building your entire function in global space which will have it run everytime to call any function so I'm guessing you would not want that. I sure wouldn't. – Cooper Nov 03 '22 at 23:07

1 Answers1

0

SpreadsheetApp.getUi() can't be used in stand alone projects ejectuted from the script editor, it only works when the stand alone project is used as a Google Editor Add-On.

I know that your script is an stand alone project because the screenshot shows the share button.

In order to be able to use SpreadsheetApp.getUi() you should,

  1. test it as Editor Add-on
  2. use it as Editor Add-on
  3. use it from a script contained in a spreadsheet

Related

Rubén
  • 34,714
  • 9
  • 70
  • 166
  • I can solve the problem of SpreadsheetApp.getUi() but now I have the following problem Exception: Range not found – Z87 Nov 04 '22 at 16:27
  • @Z87 Post a new question including the code and the textual error as text (see [mcve]) and a brief description of your search efforts as is suggested in [ask]. – Rubén Nov 04 '22 at 16:28