Hello to all. There is a GoogleSheet (output) , on which from under the client you need to put down the number 15. I have compiled a program but it just does nothing. Programs consist of: Code.gs
(server-side code), Client.js.html
(client-side code), Main.js.html
(works after loading the document), Index.html
(entry point). What could be the error? Tell me please.
Code.gs
function onOpen(e) { SpreadsheetApp.getUi() .createMenu('Value') .addItem('Estimate', 'tryExchange') .addToUi(); } function putValuesRange(value) { var ss = SpreadsheetApp.getActiveSpreadsheet(); var outputSheet = ss.getSheetByName('output'); return outputSheet.getRange(5, 5).setValue(value); } function tryExchange() { HtmlService.createTemplateFromFile('Index.html') .evaluate(); }
Client.js.html
<script> var Client = (function(client) { client.putData = function(v) { google.script.run .putValuesRange(v); }; return client; })(Client || {}); </script>
Main.js.html
<script> window.onload = function() { Client.putData(15); } </script>
Index.html
<!DOCTYPE html> <html> <head> <base target="_top"> </head> <body> <?!=HtmlService.createHtmlOutputFromFile('Client.js').getContent();?> <?!=HtmlService.createHtmlOutputFromFile('Main.js').getContent();?> </body> </html>
<html></html>
, just<script></script>
enough. Corrected. We are waiting for expert editing. - oshliaer pm