Free .NET developer tool
CSV Viewer That Handles Quoted Commas
Paste or drop a CSV file to see it as a table — parsed the RFC 4180 way, so "Smith, John" stays one field — then export JSON, a C# record or SqlBulkCopy code.
Runs entirely in your browser — nothing you paste is uploaded.
Or drop a file anywhere on this card. Files are read in your browser and never uploaded.
Preview
4 rows × 7 columns
| # | Id int | Name string | Company string | Address string | Balance decimal | Active bool | Joined DateTime? |
|---|---|---|---|---|---|---|---|
| 1 | 1 | Ada Lovelace | Analytical Engines, Ltd. | 12 St James's Square, London | 1250.50 | true | 2026-01-15 |
| 2 | 2 | Grace "Amazing Grace" Hopper | US Navy | Arlington, VA | 980.00 | true | 2025-11-03 |
| 3 | 3 | Alan Turing | Bletchley Park | Bletchley, Buckinghamshire | 0 | false | |
| 4 | 4 | Linus Torvalds | Linux Foundation | Portland, OR | 15000.75 | true | 2024-06-30 |
Export
public record Row(
int Id,
string Name,
string Company,
string Address,
decimal Balance,
bool Active,
DateTime? Joined);
Reading CSV with embedded commas in C#
string.Split(',') is the classic CSV bug: it splits inside quoted fields, so "Analytical Engines, Ltd." becomes two columns and every later field shifts. RFC 4180 says a field may be wrapped in double quotes, may then contain commas and line breaks, and writes a literal quote as two quotes. .NET ships a parser that follows those rules:
using Microsoft.VisualBasic.FileIO; // built into .NET — no package needed
using var parser = new TextFieldParser("customers.csv")
{
TextFieldType = FieldType.Delimited,
HasFieldsEnclosedInQuotes = true, // "Analytical Engines, Ltd." stays one field
};
parser.SetDelimiters(",");
string[]? header = parser.ReadFields();
while (!parser.EndOfData)
{
string[] fields = parser.ReadFields()!;
Console.WriteLine($"{fields[1]} works at {fields[2]}");
}
// Don't: "Ada,\"Analytical Engines, Ltd.\"".Split(',') → 3 fields, not 2. For typed mapping, culture-aware numbers and dates, and streaming very large files, the CsvHelper NuGet package is the de facto standard.
Bulk uploading CSV data into SQL Server
The SqlBulkCopy export above is ready to run: it builds a typed DataTable, maps columns by name, and streams the rows with the same protocol as bcp. To insert new rows and update existing ones, bulk copy into a staging table and finish with a MERGE:
-- Inserts AND updates: bulk copy into a staging table, then merge.
MERGE dbo.Customers AS target
USING dbo.Customers_Staging AS source
ON target.Id = source.Id
WHEN MATCHED THEN
UPDATE SET target.Name = source.Name, target.Balance = source.Balance
WHEN NOT MATCHED BY TARGET THEN
INSERT (Id, Name, Balance) VALUES (source.Id, source.Name, source.Balance);
TRUNCATE TABLE dbo.Customers_Staging;Frequently asked questions
How do I read a CSV file with commas inside quoted fields in C#?
Don’t use string.Split(','), which breaks a field such as "Smith, John" into two. Use a real parser: Microsoft.VisualBasic.FileIO.TextFieldParser ships with .NET and handles quotes when HasFieldsEnclosedInQuotes is true, and the CsvHelper NuGet package adds typed mapping, culture handling and streaming. Both follow RFC 4180, the same rules this viewer uses.
Why are my CSV rows splitting in the wrong place?
Usually a quoted field contains a line break, which a line-by-line reader treats as the end of the row, or a quote inside a field isn’t doubled (RFC 4180 writes a literal quote as two quotes). Paste the file here: rows whose column count differs from the header are flagged, and an unclosed quote is reported.
What is the fastest way to load a CSV file into SQL Server from .NET?
SqlBulkCopy. It streams rows to SQL Server using the same bulk-insert protocol as bcp, which is typically 10 to 100 times faster than individual INSERT statements. Load the rows into a DataTable (or an IDataReader for very large files), map columns explicitly with ColumnMappings, and set BatchSize. For inserts and updates together, bulk copy into a staging table and run a MERGE.
Why does Excel open my CSV with everything in one column?
Excel uses the list separator from the computer’s regional settings, which is a semicolon in many European locales, so a comma-separated file isn’t split. Import it through Data > From Text/CSV and choose the delimiter, or add a first line reading sep=, to the file. When writing CSV for Excel from .NET, also write a UTF-8 byte order mark so accented characters display correctly.