I new to appscript and working on a standalone script. I am reading data from a google sheet. The code works fine if I use 4 columns (text datatypes). When I include the fifth column (date datatype) on ws.getRange I get "Uncaught TypeError: Cannot read properties of null (reading 'slice')" on the browser console. Function setDadosFinal() is on a tag on an html file and function dadosParaProcura() is on a separate .gs file. Many thanks for any help.
var data; <--Global-->
function dadosParaProcura() {
const ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheet/ccc?key=PPXPPXPPXPPXPPXPPXPPXPPXPPXPPXPPX");
const ws = ss.getSheetByName("Registos");
return ws.getRange(2,1,ws.getLastRow()-1,5).getValues();
function setDadosFinal(){
google.script.run.withSuccessHandler(function(dataReturned){
data = dataReturned.slice();
}).getDataForSearch();
}
I found the the problem is caused by the inclusion of the date datatype colum because it works fine until column 4