src/ExcelReader/ExcelReader.cs
/// <summary>
/// Returns datatable object from the excel file with values retrieved as strings.
/// </summary>
/// <param name="path">Relative or absolute path to the excel file.</param>
/// <param name="options">Settings you might want to change.</param>
Returns datatable object from the excel file with values retrieved as strings.
Returns datatable object from the excel file with values retrieved as strings .
public static DataTable ToDataTable(string path, ExcelReaderOptions options = null)
        {
            if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(nameof(path));
            options = LoadOptions(options);
            IWorkbook workbook;
            using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                workbook = LoadWorkbook(stream, options);
            }
            ISheet sheet = LoadSheet(options, workbook);
            return ToDataTable(sheet, options);
        }
public static DataTable ToDataTable ( string path , ExcelReaderOptions options = null ) { if ( string . IsNullOrEmpty ( path ) ) throw new ArgumentNullException ( nameof ( path ) ) ; options = LoadOptions ( options ) ; IWorkbook workbook ; using ( var stream = new FileStream ( path , FileMode . Open , FileAccess . Read , FileShare . Read ) ) { workbook = LoadWorkbook ( stream , options ) ; } ISheet sheet = LoadSheet ( options , workbook ) ; return ToDataTable ( sheet , options ) ; }
Returns datatable object from the excel file with values retrieved as strings.
Returns datatable object from the excel file with values retrieved as strings .
path
string
Relative or absolute path to the excel file.
Relative or absolute path to the excel file .
options
ExcelReaderOptions
Settings you might want to change.
Settings you might want to change .