Interface IExcelReader
Namespace: Casewhere.Runtime.IO
Assembly: Casewhere.Runtime.IO.dll
Provide methods for reading an excel file.
var reader = Readers.GetExcelReader();
using(reader.Open(documentApi.OpenRead(ctx.Input.DocumentAttribute)))
{
var workSheetReader = reader.GetSheet(0);
var rowCount = workSheetReader.RowCount;
var columnCount = workSheetReader.ColumnCount;
for (int row = 0; row < rowCount; row++) {
for (int col = 0; col < columnCount; col++) {
var value = workSheetReader.Read<string>(row, col);
}
}
}
public interface IExcelReader : IDisposable, IIOApi
Implements
Extension Methods
ObjectExtension.ConvertToBsonValue(object), EnumExtensions.DeepClone<IExcelReader>(IExcelReader)
Methods
Close()
Close the connection to an excel file.
void Close()
GetSheet(int)
Get a sheet by its index.
IWorkSheetReader GetSheet(int index)
Parameters
index
int
The index of a sheet in the excel file.
Returns
Open(Stream)
Connect to the file stream to prepare for reading.
void Open(Stream stream)
Parameters
stream
Stream
The stream of an excel file.
Open(byte[])
Connect to the byte array of an excel file to prepare for reading.
void Open(byte[] bytes)
Parameters
bytes
byte[]
The content file in a byte array