Home > Mobile >  Not getting response back in webapp
Not getting response back in webapp

Time:02-16

I am new in app script and trying to make simple webapp, but I am not getting any return from apsscript when webpage is loading, it is returning null instead

Here is the code:-

function loadTest()
{
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  const ssname = ss.getSheetByName('Sales');
  const range = ssname.getDataRange().getValues();
  return range
}

Client side Code:-

document.addEventListener('DOMContentLoaded',(event)=>{
         const startTime = new Date()
         google.script.run.withSuccessHandler(function(e){
         console.log(e)
         }).loadTest()
       })
        

CodePudding user response:

Seems like you're trying to return prohibited elements like date from server side of webApp, which is making request fail and client getting null as a return .

Try following modification, changing this:-

const range = ssname.getDataRange().getValues();

To this :-

const range = ssname.getDataRange().getDisplayValues();

Reference:-

Parameters and Return Values

  • Related