Power Query Problems

Fix the Csv.Document Columns Parameter Error in Excel Power Query

Khadija KhanKhadija Khan Nov 25, 2026 868 views

Question details

Identify and fix an invalid Csv.Document Columns parameter in an Excel Power Query query.

Fix the Csv.Document Columns Parameter Error in Excel Power Query
Product
Microsoft Excel 2016 Power Query
Device & OS
not provided
Scenario
A workbook containing a CSV import query works on one Office 2016 computer but fails on another.
Observed behavior
Power Query displays "Expression.Error: The Csv.Document parameter 'Columns' is invalid" on the affected computer.
Before you start

Have access to the workbook and, if possible, both computers so you can compare the query and Excel builds. If the CSV is confidential, use a sanitized sample with the same column structure when seeking help.

Solution 1Recommended

Find the failing query step and inspect the Columns parameter

Use this method to locate the error and check whether the CSV import code uses a Columns value that the affected installation cannot accept.

1
Open the query

On the affected computer, select a cell in the query result table and choose Query Tools > Edit. Alternatively, use Data > Queries & Connections, then open the query for editing.

2
Identify the failing step

In Power Query Editor, select each item under Applied Steps from top to bottom. Note the first step where the error appears.

3
Review the M code

Select Home > Advanced Editor and find the Csv.Document call and its Columns parameter. Check whether Columns is hard-coded or supplied by an earlier expression.

4
Test a compatible value

In Advanced Editor, correct the Columns value if it is invalid for the CSV or the affected Power Query version. If a fixed column count is not required, test removing the Columns option, then select Done and check the preview.

5
Check the imported data

Review the column count and headers in the preview, then select Home > Close & Load. Refresh the query on the affected computer and verify that later steps still produce the expected results.

Find the failing query step and inspect the Columns parameter
Check the output after changes: Removing or changing Columns can alter the imported columns and affect later query steps. The correct value depends on the M code, CSV structure, and Power Query version.
Free Microsoft Office alternative

Work with CSV and Excel files in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface for working with CSV and Excel files. Its format support helps you move everyday spreadsheet work from Microsoft Office, although it does not fix Excel Power Query errors.

Open and work with CSV data in a spreadsheet interfaceCompatible with Microsoft Excel formats such as XLSX and XLSFamiliar tools make everyday spreadsheet work easier to migrateFree and lightweight Office alternative
microsoft office alternative - wps office

Frequently Asked Questions

Is this error caused by a VBA macro?

The message comes from a Power Query Csv.Document call, not necessarily from VBA. Open the query in Power Query Editor and inspect its Applied Steps and Advanced Editor code.

Where can I find the query's M code?

Select a cell in the query result table, choose Query Tools > Edit, and then select Home > Advanced Editor in Power Query Editor.

Why does the query work on one Office 2016 computer but not another?

The computers may have different Excel builds or Power Query capabilities. Compare File > Account > About Excel on both computers and test the query on the oldest installation that needs to run it.

Can I remove the Columns parameter?

You can test removing it in Home > Advanced Editor if a fixed column count is not required. Check the preview and later steps afterward, because the imported columns may change.