Downloads
Power Query MData sourcesBeginner

Csv.Document

Reads comma-separated (or other delimited) text from a file or binary content and returns a table.

Syntax
Csv.Document(source, optional columns, optional delimiter, optional extraValues, optional encoding)

Returns: A table, with one column for each field. The first row is usually the headers, which you promote in a later step.

What it does

Csv.Document turns a delimited text file into a table. It is the function behind most bank, card and system exports. The three settings that cause most problems are the delimiter (comma, semicolon or tab), the encoding (the way accented letters are stored) and how extra values in a line are handled. Get those right, and the rest of the query is ordinary table work.

Syntax and arguments

Example

A bank exports a statement as a semicolon-separated file with accented payee names, saved in Windows encoding. The query reads it correctly.

let
    Source = Csv.Document(
        File.Contents("C:\Banking\statement-2026-03.csv"),
        [Delimiter = ";", Encoding = TextEncoding.Windows, QuoteStyle = QuoteStyle.Csv]
    ),
    Headers = Table.PromoteHeaders(Source, [PromoteAllScalars = true]),
    Typed = Table.TransformColumnTypes(Headers, {{"Amount", type number}})
in
    Typed

The record form of the settings is what Power Query writes when you use the dialog. The headers come from the first row, and the amount column is typed as a number. If the amount uses a comma as a decimal sign, set the locale in the type step.

Example: a second, different use

Positional form, as in the syntax line: Csv.Document(File.Contents(path), null, "#(tab)", ExtraValues.Ignore, TextEncoding.Utf8) reads a tab-separated file and ignores extra values on a line.

Things to watch

In business terms

Bank statements, card transaction files, payroll exports and payment files are often CSV. Getting the delimiter and encoding right, and documenting them, is the first control in a bank reconciliation.

Related functions

All Power Query M functions · View as Markdown · M basics