Вызвать функцию сервера google apps script?
Тут описано как:
https://developers.google.com/apps-script/guides/h...
function doGet() {
return HtmlService.createHtmlOutputFromFile('Index');
}
function doSomething() {
Logger.log('I was called!');
}
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<script>
google.script.run.doSomething();
</script>
</head>
<body>
</body>
</html>
Обратите внимание.
google.script.run.doSomething(); - работает асинхронно.
Ответ можно получить в
withSuccessHandler(function)
А ошибку в.
withFailureHandler(function)
google.script.run
.withSuccessHandler(function ( response ) {
console.info(response);
})
.withFailureHandler(function ( response ) {
console.error(response);
})
.doSomething();
Так не получится:
let response = google.script.run.doSomething();
Еще можно с помощью скриплетов:
https://developers.google.com/apps-script/guides/h...
---
Максим Стоянов (stomaks),
pазработчик Google Apps Script.
g-apps-script.com
stomaks.me