Open and read existing Excel file in XlsIO

Hi,

How can I open and read existing Excel file using XlsIO ?


Thank 


3 Replies 1 reply marked as answer

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 16, 2021 02:34 PM UTC

Hi Mohd, 
 
Greetings from Syncfusion. 
 
You can open an existing file as file stream using Syncfusion XlsIO. Please look into the following link. 
 
Regards, 
Keerthi. 



GM gms-fitri December 17, 2021 03:55 AM UTC

Thank you.

Also, after opening an existing workbook, is there a way to determine the following:

1. how many worksheets in the workbook;

2. how many rows of data in the worksheet;

3. to read each rows of data in the worksheet and display all the rows in HTML;


Thanks in advance. Kind regards,



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 17, 2021 02:18 PM UTC

Hi Mohd, 

Please find the code snippets below. 

Code Snippet: 

//Creates a new instance for ExcelEngine 
ExcelEngine excelEngine = new ExcelEngine(); 

//Loads or open an existing workbook through Open method of IWorkbooks 
FileStream inputStream = new FileStream(inputFileName, FileMode.Open); 
IWorkbook workbook = excelEngine.Excel.Workbooks.Open(inputStream); 

//Worksheet Count 
int worksheetCount = workbook.Worksheets.Count; 

//Number of Rows 
int numberOfRows = workbook.Worksheets[0].UsedRange.LastRow; 
  
Syncfusion XlsIO do support conversion of Excel to HTML. Please go through the below link. 

Regards, 
Keerthi. 


Marked as answer
Loader.
Up arrow icon