What the viewer checks
The file is parsed by the same rules as CsvHelper's CsvParser with its default settings (RFC 4180): quoted fields may hold the delimiter, quotes (doubled) and line breaks, blank lines are skipped and a leading byte order mark is dropped. Two kinds of problems are marked:
- Bad data. A quote inside an unquoted field (
Marko "Mare") or text after a closing quote ("Ivan" Petrović). CsvHelper's defaultBadDataFoundthrows aBadDataExceptionon these; the viewer shows the field as CsvHelper reads it when the callback does not throw, outlined in red. - Wrong field count. A row with fewer or more fields than the header (or than the first row, without a header).
CsvReader.GetRecords<T>()throwsMissingFieldExceptionon a missing field; extra fields are ignored silently, which is how data gets lost.
The most common cause of both is an unescaped quote in a text column, or a delimiter the file was not written with. If the whole file shows one column, pick the delimiter by hand.
Sorting and filtering
Click a column header to sort ascending, again for descending, and a third time for the file order. Columns of numbers sort as numbers; everything else sorts as text with numbers inside it in order (item2 before item10), and empty cells go last. The filter keeps rows where any field contains the text, ignoring case. The table shows up to 2,000 rows at a time; filter or sort to reach the rest.
Read a CSV file in C# with CsvHelper
The code reads every record with the same settings as the viewer and collects the bad fields instead of throwing:
using System.Globalization;
using CsvHelper;
using CsvHelper.Configuration;
static (List<string[]> Records, List<string> Problems) ReadCsv(string path)
{
var problems = new List<string>();
var config = new CsvConfiguration(CultureInfo.InvariantCulture)
{
DetectDelimiter = true, // tries , ; | and tab
// Collect stray quotes instead of throwing BadDataException.
BadDataFound = args => problems.Add($"Row {args.Context.Parser!.Row}: {args.Field}"),
};
using var reader = new StreamReader(path);
using var parser = new CsvParser(reader, config);
var records = new List<string[]>();
while (parser.Read()) records.Add(parser.Record!);
return (records, problems);
}
Tested with CsvHelper 33.1 on .NET 10: it returns the same records and problems as the viewer. For typed rows, use a CsvReader and GetRecords<T>(); to turn the file into JSON, use the CSV to JSON converter, and for the other way, JSON to CSV.
FAQ
How do I open a CSV file without Excel?
Drop it on this page or use Open file. The viewer shows it as a table you can sort and filter, keeps leading zeros and long numbers as they are, and never uploads the file.
What counts as a problem in a CSV file?
Two things: a field with a stray quote, which CsvHelper reports through BadDataFound, and a row with more or fewer fields than the header (or the first row). Both are highlighted in the table and listed below it.
Why does my file show one column only?
The delimiter was not found. Detection only counts comma, semicolon, pipe and tab that appear on every line of the first 4,096 characters. Pick the delimiter by hand in the options.
How do I read a CSV file in C#?
Use CsvHelper: create a CsvParser over a StreamReader and call Read until it returns false; Record holds the fields of each row. For typed rows, use CsvReader.GetRecords<T>. The code on this page also collects the bad fields instead of throwing.
Is my file uploaded?
No. The viewer reads the file in your browser and nothing is sent anywhere.