Isolating why a CSV appears as a single column: Changing the Import-Csv Delimiter in one place

PowerShellカテゴリを表すパンダのイラスト PowerShell

About this article
This article was created using an automated generation workflow leveraging generative AI. We reviewed the Microsoft Learn Import-Csv -Delimiter specification and structured a way to test troubleshooting when a CSV appears as a single column using dummy data. No PowerShell execution was performed during the creation of this article.

Verification status: 📘 Microsoft official specification checked / PowerShell execution unverified
Information verification date: October 2, 2026.

Even in a CSV, the delimiter is not necessarily a comma. Reading a semicolon-delimited file with the default comma can make it look like a single column.

Check the column count

@'
Id;Name
1;Alice
2;Bob
'@ | Set-Content -LiteralPath "$env:TEMP\demo.csv" -Encoding utf8

$data = Import-Csv "$env:TEMP\demo.csv" -Delimiter ';'
$data[0].PSObject.Properties.Name

The default value for Delimiter is a comma. If the specified character does not match the actual delimiter, columns cannot be correctly separated into distinct properties.

Change one place

Import-Csv "$env:TEMP\demo.csv" -Delimiter ','

If the entire header looks like a single property name, you can suspect the Delimiter before jumping to the conclusion that the data is corrupted.

Verify column count programmatically

$row = Import-Csv "$env:TEMP\demo.csv" -Delimiter ';' | Select-Object -First 1
$row.PSObject.Properties.Count
flowchart TD
 A["CSV受領"] --> B["区切り文字確認"]
 B --> C["Import-Csv -Delimiter"]
 C --> D["列名/列数確認"]
 D --> E["後続処理"]

For professional use

Also check the character encoding, quotation marks, line breaks, and header names. Validate required columns immediately after loading, and halt subsequent processing if they are unexpected.

"A CSV showing as one column" does not necessarily mean it is corrupted

Even if called a CSV, actual files sometimes use delimiters other than commas. Rather than assuming Import-Csv is a universal parser that automatically detects formats visually, it is safer to verify the delimiter and header of the received data before loading.

Particularly in automated processes, cases where Import-Csv does not error out but instead "successfully reads the data as a single column" can be tricky. Validating the expected property names or column counts upfront rather than passing the data directly to subsequent steps prevents erroneous updates.

Official and Primary Sources

GitHub Sample

Document information

Article title
Isolating why a CSV appears as a single column: Changing the Import-Csv Delimiter in one place
Published
Updated
Source
https://papanda925.com/?p=17825&lang=en

License: Text and original figures for which this site holds the relevant rights are available under CC BY 4.0 , unless otherwise noted. This article may include content created or edited with generative AI. If code has a separate license notice or a linked GitHub repository license, that license takes precedence for the code. Quotations, third-party materials, images, and trademarks are excluded from this license. Usage policy

Copied title and URL