OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Appscript Google sheets returns null

  • Thread starter Thread starter uysalibov
  • Start date Start date
U

uysalibov

Guest
I have 2 sheet on my spreadsheet. My code works with first sheet but when i try with second sheet it returns null. I can't understand why. Also i checked realtime requests it looks returns my data but my sidebar value null still.

Code:
function getAllRowsData() {
  try {
    var ss = SpreadsheetApp.getActive();
    var sheet = ss.getActiveSheet();
    
    // Get the spreadsheet name
    var spreadsheetName = sheet.getName();
    
    // Get the values of all rows
    var allRows = sheet.getDataRange().getValues();
        
    // Get the column names from the first row
    var columnNames = allRows[0];
    
    // Get the data rows (excluding the header row)
    var dataRows = allRows.slice(1);
    
    var result = { spreadsheetName: spreadsheetName, columns: columnNames, rows: dataRows };
    Logger.log(result);
    return result;
  } catch (error) {
    Logger.log("An error occurred: " + error.message);
    return null;
  }
}

Code:
function getActiveCellValue() {
            google.script.run.withSuccessHandler(setData).withFailureHandler(function(e){console.error(e)}).withLogger(function(e){console.warn("The following log was generated:"+e)}).getAllRowsData();
        }

I wanted to get my data but it returns null

Continue reading...
 
Top