![]() | NanoXLSX |
NanoXLSX is a small .NET / C# library to create and read XLSX files (Microsoft Excel 2007 or newer) in an easy and native way
See the Change Log for recent updates.
*)The only requirement to compile the library besides .NET (v4.5 or newer) 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"
The NuGet package does not require dependenciesPlease note that the demo project of the .NET Standard version will not work in Visual Studio 2017. To get the build working, unload the demo project of the .NET Standard version.
The .NET version of the documentation may vary, based on the installation. If v4.5 is not available, upgrade to target to a newer version, like v4.6
The Test project and GitHub Actions may also require dependencies like unit testing frameworks or workflow steps. However, none of these dependencies are essential to build the library. They are just utilities. The test dependencies ensure efficient unit testing and code coverage. The GitHub Actions dependencies are used for the automatization of releases and API documentation
Install-Package PicoXLSX
dotnet add package PicoXLSX
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
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
Namespace | Description |
---|---|
NanoXLSX | Main namespace with all high-level classes and functions to create or read workbooks and worksheets |
NanoXLSX.Exceptions | Sub-namespace for exceptions |
NanoXLSX.LowLevel | Sub-namespace with all low-level classes and functions. This namespace is necessary to read and generate files but should not be used as pat of the API. Use the classes and functions in the namespace NanoXLSX instead |
NanoXLSX.Styles | Sub-namespace for style definitions, style handling and (static) basic styles |