G
G
Grigory Boev2019-11-05 11:05:00
Google Sheets
Grigory Boev, 2019-11-05 11:05:00

How to use DocumentApp in custom functions?

Good afternoon. We needed a function that gets the text of a document by its id . There were no problems with getting the data. But when I try to wrap it all in a custom function, I get this error:

Вам не разрешено вызывать пользователя DocumentApp.openById.
Необходимые разрешения: https://www.googleapis.com/auth/documents.

Similarly, I could not get a list of files by folder id through a custom function.
I read somewhere that working with the disk from user functions was disabled for security reasons. It's true?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2019-11-18
@ProgrammerForever

No way. Because user-defined functions are a different type from other scripts.
Custom Functions in Google Sheets | Apps Script...

Unlike most other types of Apps Scripts, custom functions never ask users to authorize access to personal data. consequent, they can only call services that do not have access to personal data, specifically the following:
Supported services notes
Cache Works, but not particularly useful in custom functions
HTML Can generate HTML, but cannot display it (rarely useful)
JDBC
language
lock Works, but not particularly useful in custom functions
Maps Can calculate directions, but not display maps
Properties
Spreadsheet Read only (can use most get*()methods, but not set*()).
Cannot open other spreadsheets ( SpreadsheetApp.openById()
or SpreadsheetApp.openByUrl()).
URL Fetch
Utilities
XML

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question