Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Not getting response back in webapp

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:-

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading