CSV is read and written by CsvIO (unvell.ReoGrid.Core.IO), following RFC 4180.

Reading and writing

// reading - the start position and the delimiter are yours to choose
CsvIO.Read(ws, File.ReadAllText("data.csv"));
CsvIO.Read(ws, File.ReadAllText("tsv.txt"), startRow: 0, startCol: 0, delimiter: '\t');

// writing - the used range is what gets written
File.WriteAllText("out.csv", CsvIO.Write(ws));

Read writes into an existing sheet; it does not build a workbook. startRow / startCol move where it writes, so several CSV files can be laid out on one sheet.

Write covers the used range. An empty sheet gives back an empty string.

Delimiter

Pass a tab as delimiter to handle TSV. The default is a comma.

How values are interpreted

Each field read is interpreted by the same rules as Cell Editing.

InputResult
1234a number
TRUE / FALSEa boolean
2026/07/28a date
=SUM(A1:A2)a formula
anything elsetext

When being interpreted as a formula is not what you want — text that happens to start with = — rewrite those cells after loading.

Quoting and escaping

Per RFC 4180.

  • A field containing the delimiter, a newline or a quote is wrapped in "
  • A " inside a field is doubled as ""

Writing escapes by the same rules.

What is not saved

CSV is a values-only format. Styles, number formats, merges, borders and cell types are not saved. Write emits the input value, not the display text — a formula cell writes out its formula.

Encoding

CsvIO deals in strings, so encoding is the caller’s responsibility. When the file is meant to be opened in Excel, write UTF-8 with a BOM.

File.WriteAllText("out.csv", CsvIO.Write(ws), new UTF8Encoding(true));

Not the same as the clipboard

The TSV used for pasting is RangeClipboard.BuildTsv(...). It takes a range and is paired with style-carrying HTML (Clipboard).

Was this article helpful?