EasyCsv 1.0.6
See the version list below for details.
dotnet add package EasyCsv --version 1.0.6
NuGet\Install-Package EasyCsv -Version 1.0.6
<PackageReference Include="EasyCsv" Version="1.0.6" />
paket add EasyCsv --version 1.0.6
#r "nuget: EasyCsv, 1.0.6"
// Install EasyCsv as a Cake Addin #addin nuget:?package=EasyCsv&version=1.0.6 // Install EasyCsv as a Cake Tool #tool nuget:?package=EasyCsv&version=1.0.6
EasyCsv Nuget
EasyCsv is a simple and efficient .NET library for handling CSV files in your projects. With a user-friendly API, it allows you to easily read, write, and manipulate CSV files with a minimal amount of code.
Features
- Read and write CSV files
- Perform basic operations on CSV files, such as adding or removing columns, filtering rows, sorting data, and replacing values in a column
- Use EasyCsv as a service in your .NET projects
- Support for dependency injection
Installation
Install the EasyCsv package via NuGet:
NuGet\Install-Package EasyCsv
or
NuGet\Install-Package EasyCsv.Core
or
NuGet\Install-Package EasyCsv.Files
Usage
Add EasyCsv services to your .NET project
In your Startup.cs
or in the class where you configure your services, add the following code to register EasyCsv services:
public void ConfigureServices(IServiceCollection services)
{
services.AddEasyCsvServices();
// services.AddEasyCsvServiceFactory();
// services.AddEasyFileCsvServiceFactory();
}
Read a CSV file
The is automatically done when you use the 'IEasyCsvServiceFactory' or 'IEasyFileCsvServiceFactory' factory to create your 'ICsvService'.
[Inject] private IEasyFileCsvServiceFactory EasyCsvServiceFactory { get; set; }
=================================================================================================================
IBrowserFile file = files[0];
var easyCsv = await EasyCsvServiceFactory.CreateFromIBrowserFileAsync(file)
// You can access the FileContentStr, FileContentBytes, and create C# Objects using GetRecords<T> at this point
Manipulate CSV data
EasyCsv provides a set of methods for manipulating CSV data. Some examples include:
No matter what you manipulate, don't forget to call csvService.CalculateFileContent()
after you are done doing your manipulations. csvService.CsvContent
is the only content that is always up to date. FileContentStr
and FileContentBytes
are calculated when you create an ICsvService
, after that they are only calculated when csvService.CalculateFileContent()
is called.
Remove a column:
var easyCsv = csvServiceFactory.CreateFromBytes(fileContent)
easyCsv.RemoveColumn("header2");
Filter rows:
easyCsv.FilterRows(row => (int)row["header1"] > 10);
Replace values in a column:
var valueMapping = new Dictionary<object, object>
{
{ "OldValue", "NewValue" }
};
easyCsv.ReplaceValuesInColumn("header1", valueMapping);
Sort data by column:
easyCsv.SortCsvByColumnData("header1", ascending: true);
For more methods and usage examples, please refer to the EasyCsv documentation and source code.
Contributing I gladly welcome contributions to EasyCsv! If you find a bug or have a feature request, please open an issue on the project's GitHub repository. If you would like to contribute code, please submit a pull request.
License EasyCsv is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 is compatible. 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. |
-
net6.0
- EasyCsv.Core (>= 1.0.2)
- EasyCsv.Files (>= 1.0.2)
-
net7.0
- EasyCsv.Core (>= 1.0.2)
- EasyCsv.Files (>= 1.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on EasyCsv:
Package | Downloads |
---|---|
EasyCsv.Components
A collection of blazor components for reading and mapping csvs. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.1 | 106 | 10/2/2024 |
2.0.0-beta8.2 | 68 | 6/4/2024 |
2.0.0-beta8.1 | 51 | 5/30/2024 |
2.0.0-beta8 | 73 | 5/30/2024 |
2.0.0-beta7 | 92 | 5/25/2024 |
2.0.0-beta6.3 | 61 | 5/20/2024 |
2.0.0-beta6.2 | 59 | 5/16/2024 |
2.0.0-beta6 | 85 | 5/12/2024 |
2.0.0-beta5 | 87 | 5/3/2024 |
2.0.0-beta4 | 44 | 5/3/2024 |
2.0.0-beta3 | 50 | 5/2/2024 |
2.0.0-beta1 | 99 | 4/29/2024 |
1.0.29 | 302 | 3/6/2024 |
1.0.28 | 180 | 2/1/2024 |
1.0.27 | 125 | 1/26/2024 |
1.0.26 | 209 | 12/21/2023 |
1.0.25 | 157 | 12/3/2023 |
1.0.24 | 90 | 12/3/2023 |
1.0.23 | 154 | 8/10/2023 |
1.0.22 | 120 | 8/7/2023 |
1.0.21 | 153 | 4/26/2023 |
1.0.20 | 133 | 4/26/2023 |
1.0.19 | 140 | 4/26/2023 |
1.0.18 | 171 | 4/7/2023 |
1.0.17 | 149 | 4/7/2023 |
1.0.16 | 156 | 4/7/2023 |
1.0.15 | 182 | 3/31/2023 |
1.0.14 | 160 | 3/31/2023 |
1.0.13 | 159 | 3/31/2023 |
1.0.12 | 157 | 3/30/2023 |
1.0.11 | 161 | 3/29/2023 |
1.0.10 | 163 | 3/29/2023 |
1.0.9 | 182 | 3/29/2023 |
1.0.8 | 182 | 3/29/2023 |
1.0.7 | 176 | 3/29/2023 |
1.0.6 | 188 | 3/27/2023 |
1.0.5 | 178 | 3/27/2023 |
1.0.4 | 175 | 3/27/2023 |
1.0.3 | 183 | 3/27/2023 |
1.0.2 | 182 | 3/27/2023 |
1.0.1 | 185 | 3/27/2023 |
1.0.0 | 186 | 3/27/2023 |