OpenExcelSdk 0.1.0
See the version list below for details.
dotnet add package OpenExcelSdk --version 0.1.0
NuGet\Install-Package OpenExcelSdk -Version 0.1.0
<PackageReference Include="OpenExcelSdk" Version="0.1.0" />
<PackageVersion Include="OpenExcelSdk" Version="0.1.0" />
<PackageReference Include="OpenExcelSdk" />
paket add OpenExcelSdk --version 0.1.0
#r "nuget: OpenExcelSdk, 0.1.0"
#:package OpenExcelSdk@0.1.0
#addin nuget:?package=OpenExcelSdk&version=0.1.0
#tool nuget:?package=OpenExcelSdk&version=0.1.0
What is OpenExcelSdk ?
OpenExcelSdk is a open-source backend .NET library to use Excel (xlsx) very easily.
It's written in C#/NET8.
The only dependency is OpenXML SDK, the official Microsoft library to work with Excel files.
This Microsoft library is not easy to use, so OpenExcelSdk propose a simple way to use Excel rows and cells values.
A quick example
Read B2 string cell value
The code below open an excel file, get the first sheet, then get the B2 cell. After that, if the type of the cell is string, get the string cell value and display it.
bool res;
ExcelError error;
ExcelCellValueMulti cellValueMulti;
// create the excel processor to read/create/update cell
ExcelProcessor proc = new ExcelProcessor();
// open an excel file
string filename = @".\Files\data.xlsx";
res = proc.Open(filename, out ExcelFile excelFile, out error);
// get the first sheet of the excel file
proc.GetFirstSheet(excelFile, out ExcelSheet excelSheet, out error);
// get cell at B7 (A is 1, B is 2)
proc.GetCellAt(excelSheet, 2, 7, out ExcelCell cell, out error);
// get the type and the value of cell
proc.GetCellTypeAndValue(excelSheet, cell, out cellValueMulti, out error);
//> type of the cell can be: string, int, double, DateTime, DateOnly, TimeOnly.
// if the cell type is string, get the value and display it
if(cellValueMulti.CellType == ExcelCellType.String)
{
Console.WriteLine("B7 type: string, value:" + proc.GetCellValueAsString(excelFile, cell));
}
Others functions
Get row/last row index
The code below get a the last row index, and also get a row at an index.
ExcelError error;
bool res;
ExcelProcessor proc = new ExcelProcessor();
string filename = @".\Files\data.xlsx";
proc.Open(filename, out ExcelFile excelFile, out error);
proc.GetSheetAt(excelFile, 0, out ExcelSheet excelSheet, out error);
int lastRowIdx = proc.GetLastRowIndex(excelSheet);
Console.WriteLine("last row idx: " + lastRowIdx);
// get row at index 0, the first one
res = proc.GetRowAt(excelSheet, 0, out ExcelRow row, out error);
if (!res)
Console.WriteLine("ERROR, unbale to read the row");
Create an excel file
The code create an excel file with one sheet.
bool res;
ExcelError error;
ExcelProcessor proc = new ExcelProcessor();
string filename = @".\Files\data.xlsx";
res=proc.CreateExcelFile(filename, out ExcelFile excelFile, out error);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- DocumentFormat.OpenXml (>= 3.3.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on OpenExcelSdk:
| Package | Downloads |
|---|---|
|
Lexerow
Lexerow is a backend dotnet library to process very easily datarows and cells in Excel files. You can for example detect empty cell in a column and set a specific value. |
GitHub repositories
This package is not used by any popular GitHub repositories.