Apps Script Web app Data transfer from ClientSide to ServerSide WebApp Sheet data and more
ClientSide to ServerSide WebApp
- Setup the doGet() method to create the web app output page. Create an object with some data and add it to the html object that is created from the template file index HtmlService.createTemplateFromFile(‘index’)
- Create the template file index in the file menu of the Google Apps Script editor.
- When the button is pressed, gather the input field data and create an object that will be the argument of the google script function sending to the function on the server side.
- Using the google script service run a function in the Apps Script called testFun sending the data from the frontend to it. google.script.run.withSuccessHandler(onSuccess).testFun(temp);
- Create a function that will receive the response data on the client side,the function that was used in the withSuccessHandler argument. Add an update to the page.
- Get the input field values and create a function called testFun() on the server side within the google Apps Script. Connect to a spreadsheet and append the row of data to the sheet. Get the value of the last row and return that to the client side within the return response value.