QuickCsv.Net 1.1.0

dotnet add package QuickCsv.Net --version 1.1.0
NuGet\Install-Package QuickCsv.Net -Version 1.1.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="QuickCsv.Net" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add QuickCsv.Net --version 1.1.0
#r "nuget: QuickCsv.Net, 1.1.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 QuickCsv.Net as a Cake Addin
#addin nuget:?package=QuickCsv.Net&version=1.1.0

// Install QuickCsv.Net as a Cake Tool
#tool nuget:?package=QuickCsv.Net&version=1.1.0

CSV_Helper_Project

csv library for loading/saving csv files relatively quickly and easily This repository serves as a quick csv parser and editor. Supports CSV standard, including multi line cell values. As always with my projects, this library is focused around simplicity and speed. test it for your your own purpose.

Supports:

  • csv standard
  • multi line cells
  • adding/removing columns
  • renaming columns
  • headers and getting cells by column name
  • custom delimiters
  • non std. encodings
  • adding, removing and inserting records

does not support (yet?)

  • automatic cell to type (eg. cell → double) parsing.
  • automatic recognition if there are headers or not
  • automatic encoding identification
  • automatic delimiter type recognition
  • automatic data type proofing (this is a string library, for IO purposes)

sample usage:

Create a Table

// create table class
CSV_Helper_Project.Table allRunResults = new CSV_Helper_Project.Table();
// set headers
allRunResults.SetColumnNames(new[] { "ChestName", "Start Invest", "Average Wagered Coins", "Average Survived Rounds", "Max Balance" });
// add data records
foreach (RunResult result in results)
{
    int index = allRunResults.AppendEmptyRecord();
    allRunResults.SetCell("ChestName", index, result.ChestName);
    allRunResults.SetCell("Start Invest", index, startCash.ToString());
    allRunResults.SetCell("Average Wagered Coins", index, result.WageredCoins.ToString());
    allRunResults.SetCell("Average Survived Rounds", index, result.BettingRounds.ToString());
    allRunResults.SetCell("Max Balance", index, result.MaxBalance.ToString());
}
allRunResults.WriteTableToFile("sample.csv");

read a table

// create table class
CSV_Helper_Project.Table runs = new CSV_Helper_Project.Table();
// load table
runs.LoadFromFile(fi.FullName, hasHeaders: true);
// access table length
RunResult[] results = new RunResult[runs.Length];
// pull data from table into class
for (int i = 0; i < runs.Length; i++)
{
    results[i] = new RunResult() 
    { 
        ChestName = runs.GetCell(i, "ChestName"),
        BettingRounds = double.Parse(runs.GetCell(i, "Average Survived Rounds")),
        WageredCoins = double.Parse(runs.GetCell(i, "Average Wagered Coins")),
        MaxBalance = double.Parse(runs.GetCell(i, "Max Balance"))
    };
}

modify a table

Table table = new Table();

// Set the column names of the table
string[] columnNames = new string[] { "ID", "Name", "Email" };
table.SetColumnNames(columnNames);

// Add a new record to the table
string[] record1 = new string[] { "1", "John Smith", "john@example.com" };
table.AppendRecord(record1);

// Add another record to the table
string[] record2 = new string[] { "2", "Jane Doe", "jane@example.com" };
table.AppendRecord(record2);

// Insert an empty record at the beginning of the table
table.InsertEmptyRecord(0);

// Remove the second record from the table
table.RemoveRecord(1);

// Overwrite the first record with new values
string[] updatedRecord = new string[] { "1", "John Doe", "john.doe@example.com" };
table.OverwriteOrInsertRecord(updatedRecord, "ID");

// Search for a record with the email "jane@example.com" and remove it if it exists
LookupValue lookup = new LookupValue("jane@example.com", "Email");
table.RemoveRecordIfExists(lookup);
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on QuickCsv.Net:

Package Downloads
QuickStatistics.Net

a quick and lightweight library to grab statistics of live data on the fly

PortfolioPerformanceTableHelper

a simple, flexible library for creating CSV entries compatible with Portfolio Performance software. It streamlines transaction management for multiple transaction types and securities.

UnhandledExceptionLogger

this is a basic error logger which logs unhandled exceptions or user defined messages to a specified logfile in csv format and/or to console

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 176 8/8/2023
1.0.6 216 7/31/2023
1.0.5 252 7/19/2023
1.0.4 140 7/19/2023
1.0.3 147 7/19/2023
1.0.2 149 7/19/2023
1.0.1 648 1/25/2023
1.0.0 301 1/9/2023

1.1.0
- finalize documentation comments
- null value return improvement

1.0.6
- improves documentation
- improves an error message when a columnname could not be matched

1.0.5:
- when saving, creates the directory first if it does not exist

1.0.4:
- Table.LoadFromFile now automatically updates the target path, so that save can be called easily.

1.0.3:
- added capability to store a target file name to the table and then call .Save()
- This can come in handy when dealing with collections of Tables

1.0.2:
- added a tracking variable which tracks if changes have been made to the table since last loading or saving it