I want to read a bulk excel file using SpreadhsheetGear
public ValueFormulaSet ReadData(string sheetName, string address)
{
var wrksh = this.Workbook.Worksheets[sheetName];
var range = wrksh.Range[address];
var result = new ValueFormulaSet();
result.RowCount = range.RowCount;
result.Values = (object[,])range.Value;
result.Formulas = (object[,])GetFormulas(range);
return result;
}
I am wondering that this approach will read the whole data and populate it in the result.Values
as I want to use bulk data file, this approach may consume much memory.
Is there any other way by which I can improve the approach for better memory optimization ?
I don't know how SpreadhsheetGear handles bulk files.
I am looking for some lazy loading approach by which I can do some buffering,
or I wish to do something like implementing IDataReader
and use SqlBulkCopy.WriteToServerAsync Method (IDataReader)
.