Import
With RadSpreadStreamProcessing you can read spreadsheet documents from the following file formats:
XLSX
CSV
This functionality is introduced in R3 2022.
Specifics
The library reads dynamically the document content. To achieve this, the IWorksheetImporter and IWorkbookImporter classes responsible for importing the elements of the document implement IDisposable and keep the corresponding content and settings into the memory until it is disposed.
Read File Data
To read the data from a file, you should parse the desired elements in a sequence keeping the following consecution:
Read the Workbook
Read a Worksheet
Read Columns (optional)
Read Rows
Read Cells
Example 1: Read data from a document
using (System.IO.FileStream fs = new System.IO.FileStream(fileName, FileMode.Open))
{
using (IWorkbookImporter workBookImporter = SpreadImporter.CreateWorkbookImporter(SpreadDocumentFormat.Xlsx, fs))
{
foreach (IWorksheetImporter worksheetImporter in workBookImporter.WorksheetImporters)
{
foreach (IRowImporter rowImporter in worksheetImporter.Rows)
{
foreach (ICellImporter cell in rowImporter.Cells)
{
string value = cell.Value;
}
}
}
}
}
Since R1 2023 SP1 there are separate properties for the formula and the value in the ICellImporter.