SweetMeSoft.Files 1.10.141

dotnet add package SweetMeSoft.Files --version 1.10.141
                    
NuGet\Install-Package SweetMeSoft.Files -Version 1.10.141
                    
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="SweetMeSoft.Files" Version="1.10.141" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SweetMeSoft.Files" Version="1.10.141" />
                    
Directory.Packages.props
<PackageReference Include="SweetMeSoft.Files" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SweetMeSoft.Files --version 1.10.141
                    
#r "nuget: SweetMeSoft.Files, 1.10.141"
                    
#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.
#:package SweetMeSoft.Files@1.10.141
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SweetMeSoft.Files&version=1.10.141
                    
Install as a Cake Addin
#tool nuget:?package=SweetMeSoft.Files&version=1.10.141
                    
Install as a Cake Tool

SweetMeSoft.Files

Library for file manipulation.

Description

SweetMeSoft.Files is a library for .NET Standard 2.1 that facilitates reading and writing various file formats, such as CSV, Excel, TXT, XML, HTML and ZIP. It abstracts the complexity of underlying libraries and provides a simple and unified API for working with files.

Features

  • CSV: Reading and writing CSV files using CsvHelper.
  • Excel: Reading and writing Excel files (.xlsx) with EPPlus and 2003 version (.xls) with NPOI.
  • HTML: Reading tables from HTML files using HtmlAgilityPack.
  • TXT: Reading and writing plain text files.
  • XML: Serialization and deserialization of objects to and from XML format.
  • ZIP: File compression and decompression.

Installation

You can install the package through the NuGet Package Manager console:

Install-Package SweetMeSoft.Files

Or via the .NET CLI:

dotnet add package SweetMeSoft.Files

Usage

Below are usage examples for each supported file type.

CSV

Read a CSV file to a list of objects

using SweetMeSoft.Files;
using SweetMeSoft.Base;

// Assumes you have a StreamFile, which is a wrapper with the stream and file metadata.
var streamFile = new StreamFile("path/to/file.csv");
IEnumerable<MyModel> records = await Csv.Read<MyModel>(streamFile);

// You can also use a Stream directly.
using (var stream = File.OpenRead("path/to/file.csv"))
{
    IEnumerable<MyModel> records = await Csv.Read<MyModel>(stream);
}

Create a CSV file from a list of objects

var myList = new List<MyModel> { /* ... your data ... */ };
StreamFile csvFile = await Csv.Create(myList, "new_file.csv");

Excel

Read an Excel file (.xlsx)

var streamFile = new StreamFile("path/to/file.xlsx");
IEnumerable<MyModel> records = Excel.Read<MyModel>(streamFile);

Read an Excel 2003 file (.xls)

var streamFile = new StreamFile("path/to/file.xls");
IEnumerable<MyModel> records = Excel.Read2003File<MyModel>(streamFile);

Generate an Excel file

var myList = new List<MyModel> { /* ... your data ... */ };
StreamFile excelFile = Excel.Generate(myList, "Sheet1", "report.xlsx");

HTML

Read a table from an HTML file

var streamFile = new StreamFile("path/to/file.html");
List<MyModel> records = await Html.ReadTable<MyModel>(streamFile);

TXT

Read lines from a text file

using (var stream = File.OpenRead("path/to/file.txt"))
{
    List<string> lines = await Txt.ReadLines(stream);
}

Generate a text file

var lines = new List<string> { "Line 1", "Line 2" };
StreamFile txtFile = await Txt.Generate(lines, "my_file.txt");

XML

Read (deserialize) from XML

using (var stream = File.OpenRead("path/to/file.xml"))
{
    MyModel myObject = await Xml.Read<MyModel>(stream);
}

Create (serialize) to XML

var myObject = new MyModel { /* ... your data ... */ };
StreamFile xmlFile = Xml.Create(myObject, "my_object.xml");

ZIP

Decompress a ZIP file

using (var stream = File.OpenRead("path/to/file.zip"))
{
    List<StreamFile> uncompressedFiles = await Zip.Uncompress(stream);
}

Compress files into a ZIP

var file1 = new StreamFile(/* ... */);
var file2 = new StreamFile(/* ... */);
StreamFile zipFile = await Zip.Compress("my_file.zip", file1, file2);

Dependencies

  • CsvHelper
  • EPPlus
  • HtmlAgilityPack
  • NPOI
  • System.Linq.Async
  • SweetMeSoft.Base
  • SweetMeSoft.Tools

License

This project is distributed under the MIT license.

Product 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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.10.141 349 11/30/2025
1.10.139 398 9/17/2025
1.10.138 357 9/17/2025
1.10.137 444 7/5/2025
1.10.136 206 1/16/2025
1.10.135 276 9/5/2024
1.10.134 243 8/30/2024
1.10.133 238 7/23/2024
1.10.132 257 7/10/2024
1.10.131 283 11/27/2023
1.10.130 195 11/27/2023
1.10.129 217 11/3/2023
1.10.128 216 10/3/2023
1.10.127 258 9/14/2023
1.10.126 236 8/23/2023
1.10.125 291 7/4/2023
1.10.124 312 6/1/2023
1.10.123 296 6/1/2023
1.10.122 288 6/1/2023
Loading failed