Net4x.SpreadsheetLibrary.Utility
1.9.9.6
dotnet add package Net4x.SpreadsheetLibrary.Utility --version 1.9.9.6
NuGet\Install-Package Net4x.SpreadsheetLibrary.Utility -Version 1.9.9.6
<PackageReference Include="Net4x.SpreadsheetLibrary.Utility" Version="1.9.9.6" />
<PackageVersion Include="Net4x.SpreadsheetLibrary.Utility" Version="1.9.9.6" />
<PackageReference Include="Net4x.SpreadsheetLibrary.Utility" />
paket add Net4x.SpreadsheetLibrary.Utility --version 1.9.9.6
#r "nuget: Net4x.SpreadsheetLibrary.Utility, 1.9.9.6"
#:package Net4x.SpreadsheetLibrary.Utility@1.9.9.6
#addin nuget:?package=Net4x.SpreadsheetLibrary.Utility&version=1.9.9.6
#tool nuget:?package=Net4x.SpreadsheetLibrary.Utility&version=1.9.9.6
SpreadsheetLibrary.Utility
Small utility helpers used by the SpreadsheetLibrary projects to support saving workbooks, converting legacy XLS to XLSX, and simple file-picking abstractions for UI/tooling integrations.
Purpose
- Provide lightweight helpers that are orthogonal to core spreadsheet processing: converting
.xlsstreams to.xlsx, selecting a save target via an abstraction, converting collections of CSV text intoDataSetinstances and other small helpers. - Keep UI/OS-specific file-picking code isolated behind
ISaveFilePickerso library code remains testable and cross-platform where possible.
Main components
ISaveFilePicker(interface)- Abstraction for picking a file name/path to save to. Implement this in your UI layer or test harness to control where save dialogs appear.
- Method:
Task<(bool, string)> PickFile(string fileName)� returns a tuple indicating whether a file was selected and the selected path.
SaveFilePickerExtension(extensions)- Helpers for coordinating multiple
DataTable/DataSetsaves using anISaveFilePickerimplementation. SaveDataTablesToExcelAsynchelpers will prompt (viaISaveFilePicker) and then write Excel files when appropriate, logging issues viaILogger.
- Helpers for coordinating multiple
XlsToXlsxConverter- Converts an in-memory stream containing a legacy HSSF
.xlsworkbook into an XSSF.xlsxbyte array using NPOI. - Preserves sheet names, cell values, styles, merged regions and column widths where possible.
- Useful for workflows that need to normalize legacy Excel files to XLSX prior to further processing.
- Converts an in-memory stream containing a legacy HSSF
SaveToDictionaryExtensionandListExtension(CSV helpers)- Convert string/CSV collections into dictionary-backed
DataSetinstances for later export to Excel or processing. - Provide small helpers to normalize collections and read CSV via
SpreadsheetLibrary.Csvutilities.
- Convert string/CSV collections into dictionary-backed
Compatibility and dependencies
- The utilities use NPOI (
NPOI.HSSF,NPOI.XSSF,NPOI.SS) to manipulate Excel workbooks and ICSharpCode.SharpZipLib where appropriate (transitive dependency via NPOI for some runtimes). - The project includes code compiled for older frameworks (net35/net40) and newer netstandard targets; ensure you reference compatible NPOI packages for your target framework.
Usage examples
Convert a legacy .xls stream to .xlsx bytes:
using (var fs = File.OpenRead("legacy.xls"))
{
var xlsxBytes = fs.ConvertXlsToXlsx();
File.WriteAllBytes("converted.xlsx", xlsxBytes);
}
Pick a save file and write a dataset to Excel (UI specific ISaveFilePicker required):
var (ok, path) = await saveFilePicker.PickFile("20250101-120000.xls");
if (ok && !string.IsNullOrWhiteSpace(path))
{
dataSet.ToExcel(path, isXlsx: false, logger: logger);
}
Convert an enumerable of CSV text into a DataSet for export:
var dict = SaveToDictionaryExtension.SaveToDictionary(myEnumerable);
var dataSet = dict.GetAsDataSet("Export");
Notes and recommendations
XlsToXlsxConverterattempts to copy styles and merged regions but very complex legacy workbooks may not round-trip perfectly.ISaveFilePickeris intentionally minimal � provide an implementation appropriate for desktop, web or automated test environments.- The save helpers prefer a non-empty selection; callers should validate returned paths.
License / Contributing
See repository root for license and contribution guidelines.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 3.5
- Net4x.AsyncBridge (>= 1.5.0.8)
- Net4x.DapperLibrary.Base (>= 1.9.9.6)
- Net4x.DapperLibrary.Extensions.Base (>= 1.9.9.6)
- Net4x.SpreadsheetLibrary.Base (>= 1.9.9.6)
-
.NETFramework 4.0
- Net4x.AsyncBridge (>= 1.5.0.8)
- Net4x.DapperLibrary.Base (>= 1.9.9.6)
- Net4x.DapperLibrary.Extensions.Base (>= 1.9.9.6)
- Net4x.SpreadsheetLibrary.Base (>= 1.9.9.6)
-
.NETFramework 4.5
- Net4x.AsyncBridge (>= 1.5.0.8)
- Net4x.DapperLibrary.Base (>= 1.9.9.6)
- Net4x.DapperLibrary.Extensions.Base (>= 1.9.9.6)
- Net4x.SpreadsheetLibrary.Base (>= 1.9.9.6)
-
.NETFramework 4.6.1
- Net4x.AsyncBridge (>= 1.5.0.8)
- Net4x.DapperLibrary.Base (>= 1.9.9.6)
- Net4x.DapperLibrary.Extensions.Base (>= 1.9.9.6)
- Net4x.SpreadsheetLibrary.Base (>= 1.9.9.6)
- SharpZipLib (>= 1.4.2)
-
.NETStandard 2.0
- Net4x.AsyncBridge (>= 1.5.0.8)
- Net4x.DapperLibrary.Base (>= 1.9.9.6)
- Net4x.DapperLibrary.Extensions.Base (>= 1.9.9.6)
- Net4x.SpreadsheetLibrary.Base (>= 1.9.9.6)
- SharpZipLib (>= 1.4.2)
-
.NETStandard 2.1
- Net4x.AsyncBridge (>= 1.5.0.8)
- Net4x.DapperLibrary.Base (>= 1.9.9.6)
- Net4x.DapperLibrary.Extensions.Base (>= 1.9.9.6)
- Net4x.SpreadsheetLibrary.Base (>= 1.9.9.6)
- SharpZipLib (>= 1.4.2)
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 |
|---|---|---|
| 1.9.9.6 | 78 | 1/6/2026 |
| 1.9.9.5 | 75 | 1/6/2026 |
| 1.9.9.4 | 75 | 1/6/2026 |
| 1.9.9.3 | 80 | 1/5/2026 |
| 1.9.9.2 | 82 | 12/30/2025 |
| 1.9.9.1 | 86 | 12/30/2025 |
| 1.9.9 | 179 | 12/22/2025 |
| 1.6.0.12 | 121 | 12/12/2025 |
| 1.6.0.11 | 122 | 12/12/2025 |
| 1.6.0.10 | 441 | 12/9/2025 |
| 1.6.0.9 | 190 | 12/4/2025 |
| 1.6.0.8 | 189 | 12/4/2025 |
| 1.6.0.7 | 258 | 11/30/2025 |
| 1.6.0.6 | 184 | 11/27/2025 |
| 1.6.0.5 | 236 | 11/22/2025 |
| 1.6.0.4 | 144 | 11/16/2025 |
| 1.6.0.3 | 189 | 11/15/2025 |
| 1.6.0.2 | 278 | 11/14/2025 |
| 1.6.0.1 | 230 | 11/10/2025 |
| 1.6.0 | 213 | 11/9/2025 |
| 1.5.0.3 | 200 | 11/5/2025 |
| 1.5.0.2 | 201 | 11/3/2025 |
| 1.5.0.1 | 201 | 11/3/2025 |
| 1.5.0 | 158 | 10/26/2025 |
| 1.4.1.6 | 181 | 10/24/2025 |
| 1.4.1.5 | 190 | 10/22/2025 |
| 1.4.1.4 | 194 | 10/22/2025 |
| 1.4.1.2 | 206 | 5/30/2025 |
| 1.4.1.1 | 206 | 4/30/2025 |
| 1.4.1 | 203 | 4/30/2025 |
| 1.4.0 | 227 | 3/31/2025 |
| 1.1.0 | 259 | 8/27/2023 |