Why is this Server side script not getting the Spreadsheet values?

51 views Asked by At

Server side Script

function getSpreadsheetValues(){
   return SpreadsheetApp.openById('1b3OWfUb3d0jy0DhxJzTYEHen- 
FHhD7nECF5NCgSDHiM').getSheetByName('Sheet1').getDataRange().getValues();
}

Client side Script

function readData(result){
// put the values in cells array
   var cells=[];
   cells=result;
  alert(“cell values=“+cells);// 'cell values= undefined'
}
function fail(error){
alert('Sheet not read' + error.message);
}
function getData() {
 google.script.run
  .withSuccessHandler(readData())
  .withFailureHandler(fail()) 
  .getSpreadsheetValues();
}
getData();

The readData function is fired, so the getSpreadsheetValues() didn't report an error, but the "cells" are undefined. The Spreadsheet is "sheets" format and has 6 rows and 3 column of string data.

0

There are 0 answers