XlsxReader
public static class XlsxReader
Namespace SharpCell.Xlsx · package SharpCell.Xlsx
Reads .xlsx workbooks: sheets, values, formulas with the results Excel cached, defined names, tables, hidden rows, whether a sheet is filtered, the date system, number formats, cell styles, column widths, row heights, merged cells, frozen panes and gridlines, from .xlsx and macro-enabled .xlsm files. Charts, pivot tables and macros are not read (a save keeps them; macros never run).
Every formula is out of date after loading: Cell.Value shows the value cached in the file until Workbook.Recalculate calculates it. A formula SharpCell cannot parse (for example a link to another workbook) does not fail the load; once calculated it is #NAME? and listed in Workbook.Diagnostics.
The workbook keeps the file's bytes in memory, so XlsxWriter can write changes into the same file.
Methods
Load(Stream)
public static Workbook Load(Stream stream)
Reads a workbook from a stream, which is left open.
Parameters
stream: The .xlsx content; it need not be seekable.
Returns: The workbook, with the results Excel saved until it is recalculated.
Exceptions
InvalidDataException: The file is not a well-formed .xlsx workbook.NotSupportedException: The file is .xls, .xlsb or encrypted.
Load(string)
public static Workbook Load(string path)
Reads a workbook from a file.
Parameters
path: Path of the .xlsx file.
Returns: The workbook, with the results Excel saved until it is recalculated.
Exceptions
InvalidDataException: The file is not a well-formed .xlsx workbook.NotSupportedException: The file is .xls, .xlsb or encrypted.