NanoXLSX 1.5.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NanoXLSX --version 1.5.0                
NuGet\Install-Package NanoXLSX -Version 1.5.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="NanoXLSX" Version="1.5.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NanoXLSX --version 1.5.0                
#r "nuget: NanoXLSX, 1.5.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 NanoXLSX as a Cake Addin
#addin nuget:?package=NanoXLSX&version=1.5.0

// Install NanoXLSX as a Cake Tool
#tool nuget:?package=NanoXLSX&version=1.5.0                

NanoXLSX

NanoXLSX

NanoXLSX is a small .NET library written in C#, to create and read Microsoft Excel files in the XLSX format (Microsoft Excel 2007 or newer) in an easy and native way

  • No dependencies (*
  • No need for an installation of Microsoft Office
  • No need for Office interop libraries
  • No need for 3rd party libraries
  • No need for an installation of the Microsoft Open Office XML SDK (OOXML)

Project website: https://picoxlsx.rabanti.ch

See the Change Log for recent updates.

Reader Support

Currently, only basic reader functionality is available:

  • Reading and casting of cell values into the appropriate data types
  • Reading of several worksheets in on workbook with names
  • Limited processing of styles (when reading) at the moment
  • No support of other objects than spreadsheet data at the moment

Note: Styles in loaded files are only considering number formats (to determine date and time values), as well as custom formats. The scope of reader functionality may change with future versions.

Requirements

NanoXLSX is based on PicoXLSX and was created with .NET version 4.5. Newer versions like 4.6.1 are working and tested. Older versions like 3.5 and 4.0 may also work with minor changes. Some functions introduced in .NET 4.5 were used and must be adapted in this case.

*)The only requirement to compile the library besides .NET is the assembly WindowsBase, as well as System.IO.Compression. These assemblies are standard components in all Microsoft Windows systems (except Windows RT systems). If your IDE of choice supports referencing assemblies from the Global Assembly Cache (GAC) of Windows, select WindowsBase and Compression from there. If you want so select the DLLs manually and Microsoft Visual Studio is installed on your system, the DLL of WindowsBase can be found most likely under “c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll”, as well as System.IO.Compression under "c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.IO.Compression.dll". Otherwise you find them in the GAC, under “c:\Windows\Microsoft.NET\assembly\GAC_MSIL\WindowsBase” and "c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.IO.Compression"

If you want to compile the documentation project (folder: Documentation; project file: shfbproj), you need also the Sandcastle Help File Builder (SHFB). It is also freely available. But you don't need the documentation project to build the NanoXLSX library.

Installation

Using Nuget

By package Manager (PM):

Install-Package NanoXLSX

By .NET CLI:

dotnet add package NanoXLSX

As DLL

Simply place the NanoXLSX DLL into your .NET project and add a reference to it. Please keep in mind that the .NET version of your solution must match with the runtime version of the NanoXLSX DLL (currently compiled with 4.5).

As source files

Place all .CS files from the NanoXLSX source folder and its sub-folders into your project.

Usage

Quick Start (shortened syntax)

 Workbook workbook = new Workbook("myWorkbook.xlsx", "Sheet1");         // Create new workbook with a worksheet called Sheet1
 workbook.WS.Value("Some Data");                                        // Add cell A1
 workbook.WS.Formula("=A1");                                            // Add formula to cell B1
 workbook.WS.Down();                                                    // Go to row 2
 workbook.WS.Value(DateTime.Now, Style.BasicStyles.Bold);               // Add formatted value to cell A2
 workbook.Save();                                                       // Save the workbook as myWorkbook.xlsx

Quick Start (regular syntax)

 Workbook workbook = new Workbook("myWorkbook.xlsx", "Sheet1");         // Create new workbook with a worksheet called Sheet1
 workbook.CurrentWorksheet.AddNextCell("Some Data");                    // Add cell A1
 workbook.CurrentWorksheet.AddNextCell(42);                             // Add cell B1
 workbook.CurrentWorksheet.GoToNextRow();                               // Go to row 2
 workbook.CurrentWorksheet.AddNextCell(DateTime.Now);                   // Add cell A2
 workbook.Save();                                                       // Save the workbook as myWorkbook.xlsx

Quick Start (read)

 Workbook wb = Workbook.Load("basic.xlsx");                             // Read the workbook
 System.Console.WriteLine("contains worksheet name: " + wb.CurrentWorksheet.SheetName);
 foreach (KeyValuePair<string, Cell> cell in wb.CurrentWorksheet.Cells)
 {
    System.Console.WriteLine("Cell address: " + cell.Key + ": content:'" + cell.Value.Value + "'");
 }

Further References

See the full API-Documentation at: https://rabanti-github.github.io/NanoXLSX/.

The Demo project contains 15 simple use cases. You can find also the full documentation in the Documentation-Folder (html files or single chm file) or as C# documentation in the particular .CS files.

See also: Getting started in the Wiki

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NanoXLSX:

Package Downloads
HighbornBD

Sistema simples de banco de dados pra codigos VB e C#

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.5.1 795 10/25/2024
2.5.0 9,418 7/22/2024
2.4.0 15,959 4/21/2024
2.3.3 3,244 2/24/2024
2.3.1 8,769 1/22/2024
2.3.0 11,908 9/7/2023
2.2.0 21,228 4/23/2023
2.1.1 7,426 3/4/2023
2.1.0 43,333 11/8/2022
2.0.4 3,172 10/4/2022
2.0.3 511 10/1/2022
2.0.2 384 9/29/2022
2.0.1 1,103 9/10/2022
2.0.0 536 9/3/2022
1.8.7 2,939 8/6/2022
1.8.6 2,403 4/1/2022
1.8.5 784 3/26/2022
1.8.4 3,892 3/20/2022
1.8.3 1,123 3/10/2022
1.8.2 6,561 12/20/2021
1.8.1 1,917 9/12/2021
1.8.0 2,050 7/9/2021
1.7.0 574 6/5/2021
1.6.0 587 4/18/2021
1.5.0 825 12/10/2020
1.4.1 656 9/13/2020
1.4.0 541 8/30/2020
1.3.6 544 7/19/2020
1.3.5 2,133 1/12/2020
1.3.4 573 12/1/2019
1.3.3 910 5/20/2019
1.3.2 865 12/8/2018
1.3.1 740 11/4/2018
1.3.0 921 10/6/2018
1.2.4 793 8/24/2018
1.2.3 854 8/24/2018