1

I created a Library in Google script as a standalone script with a function function1. I published a version of this script.

I also have a spreadsheet, and using a bound script, I added my library with identifier XXXX and managed to launch from scripts.google.com the function using a wrapper around function1 and logging the results :

function function2()
{
  return XXXX.function1();
}

function test()
{
  Logger.log(function2());
}

The problem is I cannot call this function from a cell in the spreadsheet. I get the error

Library with identifier XXXX is missing (perhaps it was deleted, or you don't have read access?) (ligne 0).

I am the owner of the scripts and the spreadsheet.

Rubén
  • 34,714
  • 9
  • 70
  • 166
fyusuf-a
  • 255
  • 1
  • 9
  • I think that for example, if the library of `XXXX` has the script of `function function1() {return "ok"}` and the client side has `XXXX.function1()`, the script of the client side works. So for example, when you reinstall the library and test it again, what result will you get? And also, can I ask you about the detail of `managed to launch from scripts.google.com the function using a wrapper around function1`? – Tanaike Aug 23 '20 at 22:17
  • Possible duplicate [How to call library function as custom function from spreadsheet formula?](https://stackoverflow.com/q/49616415/1595451) – Rubén Aug 23 '20 at 22:53
  • @Tanaike : taking as function1 a function doing 'Logger.log("hello"); return "ok";'. In the script bound to the spreasheet, if I select the function function2 in the "select function" dropdown menu and click the play logo, I can see "hello" and no error in the logs. – fyusuf-a Aug 24 '20 at 08:29
  • Thank you for replying. In my environment, the library has the script of `function function1() {Logger.log("hello"); return "ok"}`, and when the client run the script of `XXX.function1()` (`XXX` is the identification of library.), I can see the values of `hello` and `ok` in the log. Unfortunately, I cannot replicate your situation. I apologize for this. – Tanaike Aug 24 '20 at 11:48
  • I cannot reproduce this behaviour. If I understand you correctly, the library is successfully called when executing `function2` from the script editor itself, but not when `function2` is used as a custom function in sheets? – Iamblichus Aug 25 '20 at 10:02
  • The only I can think of is that the script to which the spreadsheet is bound and the one in which you imported the library are actually not the same one, could you double-check that you have imported the library to the bound script? – Iamblichus Aug 25 '20 at 10:11

0 Answers0