TsadriuUtilities.Excel 2.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TsadriuUtilities.Excel --version 2.3.0                
NuGet\Install-Package TsadriuUtilities.Excel -Version 2.3.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TsadriuUtilities.Excel" Version="2.3.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TsadriuUtilities.Excel --version 2.3.0                
#r "nuget: TsadriuUtilities.Excel, 2.3.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TsadriuUtilities.Excel as a Cake Addin
#addin nuget:?package=TsadriuUtilities.Excel&version=2.3.0

// Install TsadriuUtilities.Excel as a Cake Tool
#tool nuget:?package=TsadriuUtilities.Excel&version=2.3.0                

TsadriuUtilities.Excel

A small package that parses an Excel (XLSX only).

TsadriuUtilities.Excel is a library that helps on dealing with XLSX files, to make it easier and save a little bit of time.

> Features <

ExcelWorkbook:

To create a new instance, use IExcelWorkbook workbook = new ExcelWorkbook("fullFilePath", CultureInfo = null) + 2 overload;

  • List<IExcelSheet> SheetList { get; set; }
    • Gets or sets the IExcelSheet list of the current IExcelWorkbook.
  • GetSheet(int index) + 1 overload:
    • Gets the IExcelSheet based on the index. If the IExcelSheet is not found, it will return a new IExcelSheet with the name UNDEFINED.
    • Supports workbook[int index], workbook[string "sheetName"] variants.

ExcelSheet:

To create a new instance, use IExcelSheet sheet = new ExcelSheet();

  • string Name { get; set; }
    • Gets or sets the sheet name.
  • int Id { get; set; }
    • Gets or sets the sheet id (this is based on the excel's sheet order).
  • bool IsVisible { get; set; }
    • Gets or sets the visibility of a Sheet.
  • List<IExcelCell> CellList { get; set; }
    • Gets or sets the cell list.
  • int LastColumnIndex { get; set; }
    • Gets or sets the last column index. This index is 0-based.
  • int LastRowIndex { get; set; }
    • Gets or sets the last row index. This index is 0-based.
  • AddCell(IExcelCell cell):
    • Adds a IExcelCell to the sheet.
  • GetCell(Coordinate coordinate) + 2 overload:
    • Returns the IExcelCell based on the coordinate.
    • Supports sheet[Coordinate coordinate], sheet[int columnIndex, int **rowIndex] and sheet[string excelCoordinate] variants.
  • GetCellValue<T>(Coordinate coordinate):
    • Retrieves the cell's value based on the IExcelCell.Type (if the IExcelCell.Type is CellTypeEnum.Formula, it will use IExcelCell.SubType instead). Exception is thrown when the IExcelCell.Type is not the same as the T.
  • GetCellType(Coordinate coordinate, bool avoidFormulaType = true):
    • Retrieves the ExcelCell type.
    • If avoidFormulaType is set to true and IExcelCell.Type is CellTypeEnum.Formula, it will return the IExcelCell.SubType.
    • If avoidFormulaType is set to false, it returns the IExcelCell.Type, no matter what it is.
  • GetCellCoordinate(string cellValue, StringComparison comparison = StringComparison.OrdinalIgnoreCase):
    • Retrieves the Coordinate of the IExcelCell from the CellList by comparing the IExcelCell.StringValue or IExcelCell.NumericValue with the cellValue.

ExcelCell:

To create a new instance, use IExcelCell cell = new ExcelCell() + 3 overload;

  • Coordinate Coordinate { get; set; }
    • Gets or sets the cell's coordinate.
  • string StringValue { get; set; }
    • Gets or sets the cell's string/text value.
  • double NumericValue { get; set; }
    • Gets or sets the cell's numeric value. This is only available if the Type" is CellTypeEnum.Numeric.
  • DateTime DateTimeValue { get; set; }
    • Gets the cell's DateTime value. If the Type is CellTypeEnum.Numeric, it will try to convert it into a DateTime.
  • CellTypeEnum Type { get; set; }
    • Gets or sets the cell's type CellTypeEnum.String, CellTypeEnum.Numeric or CellTypeEnum.Formula).
  • CellTypeEnum SubType { get; set; }
    • Gets or sets the cell's subtype CellTypeEnum.String or CellTypeEnum.Numeric). This is used when Type is a CellTypeEnum.Formula.
  • bool IsFormula { get; set; }
    • Gets a value indicating whether the cell is a formula based on Type.
  • string FormulaValue { get; set; }
    • Gets or sets the cell's formula's value. This is only available when the IsFormula is true.
  • GetValueAsString(bool isDateTime = false):
    • Checks the cell's Type and SubType. If either is CellTypeEnum.String or CellTypeEnum.Numeric, it will return the content as a string.
    • If the cell is a DateTime, set isDateTime to true.
  • GetCellContaining(StringComparison comparison, params string[] values):
    • Checks the CellList and tries to return the IExcelCell that contains the values.
    • If the IExcelCell is not found, it will return an empty IExcelCell.

Coordinate:

To create a new instance, use Coordinate coordinate = new Coordinate() + 1 overload;

  • int ColumnIndex { get; set; }
    • Gets or sets the column index (0-based index).
  • int RowIndex { get; set; }
    • Gets or sets the row index (0-based index).
  • string ExcelIndex { get; set; }
    • Gets or sets the index of the column and row of the excel.
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.5.1 492 6/16/2023
2.5.0 536 2/17/2023
2.4.1 242 2/15/2023
2.4.0 249 2/15/2023
2.3.0 271 2/10/2023
2.2.1 240 2/9/2023
2.2.0 349 1/20/2023
2.1.2 352 12/14/2022
2.1.0 302 12/14/2022
2.0.0 292 12/14/2022
1.1.2 417 5/31/2022
1.1.1 394 5/31/2022
1.1.0 415 5/31/2022
1.0.2 419 5/30/2022

ExcelWorkbook:
- Implemented indexing operators. Now you can do the following:
  - IExcelSheet sheet = workbook[0];
  - IExcelSheet sheet = workbook["sheetName"];

ExcelSheet:
- Implemented indexing operators. Now you can do the following:
  - IExcelCell cell = sheet[coordinate];
  - IExcelCell cell = sheet[columnIndex, rowIndex];
  - IExcelCell cell = sheet["A12"];