How to get rows and columns count of a given sheet?

Hello

I'm working with your Essentials JS 1 Spreadsheet

I need to get the number of rows and columns into a given sheet (for example the currently active one).

The sheet object has the colCount and rowCount properties, but how to read their values?


A viable alternative, would be to have the possibility to get the complete range indices of a given sheet, is it possible?


Thanks


1 Reply 1 reply marked as answer

SP Sangeetha Priya Murugan Syncfusion Team June 13, 2022 11:41 AM UTC

Hi Massimiliano,


Your reported requirement can be achievable in our spreadsheet by getting sheet object from the spreadsheet instance as like as below.


Code Block:


  

 

 function btnClick(args) {

  var excelObj = $("#Spreadsheet").ejSpreadsheet("instance");

   // to get active sheet index

  var sheetIdx = excelObj.getActiveSheetIndex();

// To get sheet object

var sheet = excelObj.getSheet(sheetIdx);

        // rowcount in the active sheet

console.log("rowCount " + sheet.rowCount);

//column count in active sheet

console.log("colCount " + sheet.colCount);

// used ranges in the active sheet

console.log( sheet.usedRange);

}


For your convenience we have prepared the sample based on our suggestion. Please find the link below.


Sample Link: https://jsplayground.syncfusion.com/qk4wihjf


API Link: https://help.syncfusion.com/api/js/ejspreadsheet#methods:getsheet


https://help.syncfusion.com/api/js/ejspreadsheet#methods:getactivesheetindex


Could you please check the above links and get back to us, if you need any further assistance on this.


Regards,

Sangeetha M


Marked as answer
Loader.
Up arrow icon