How to read the whole data from the spreadsheet

Initially i created the spreadsheet with empty data source and i typed something in the sheet. Now the question is, i want to read the entire data which i was typed in the spreadsheet using react spreadsheet component

3 Replies 1 reply marked as answer

MV Madhan Venkateshan Syncfusion Team August 20, 2020 12:47 PM UTC

Hi Selva, 
 
Good day to you. 
 
You can use the ‘getData’ method and pass the range as used range to get the entire data of the spreadsheet. Please refer the below sample link. 
 
 
Regards, 
Madhan V 



SE Selva August 20, 2020 03:45 PM UTC

Hi Madhan,

Able to get the active rowindex and column index but not able to get the data. In the following example also, using getData() throws an exception "Uncaught (in promise) TypeError: Cannot read property 'rows' of undefined". I'm also facing the same issue. Please refer the sample code

let activeRowIndex = this.spreadsheet.getActiveSheet().usedRange.rowIndex;
let activeColIndex = this.spreadsheet.getActiveSheet().usedRange.colIndex;
let sheetName = this.spreadsheet.getActiveSheet().name;
console.log(activeRowIndex+"=="+activeColIndex+"=="+sheetName);
this.spreadsheet.getData(sheetName + getRangeAddress([0, 0, activeRowIndex, activeColIndex])).then((cells)=>{
cells.forEach((cell, key)=>{
console.log(key + " : " + cell.value);
})
});


MV Madhan Venkateshan Syncfusion Team August 25, 2020 08:43 AM UTC

Hi Selva, 
 
Sorry for the inconvenience caused. 
 
You need to add ‘!’ symbol between sheet name and cell address to resolve your issue. Please refer the below code snippets and sample link. 
 
this.spreadsheet.getData(this.spreadsheet.getActiveSheet().name + "!"+ getRangeAddress([0, 0, usedRowIdx, usedColIdx])).then((cells)=>{ 
 
 
Regards, 
Madhan V 


Marked as answer
Loader.
Up arrow icon