Automation · Data Formats › CSV
Parsing
Cheat sheet · https://pcornel.dk/topic.php?topic=5839
Answer
Parse CSV with a real parser, such as Import-Csv -Delimiter or Python's csv module, not by splitting on commas, so quoted fields, embedded newlines and encodings like UTF-8 with BOM are handled.
Remember
- Use Import-Csv or Python's csv module, not string splitting.
- Quoted fields can contain commas and newlines.
- Check encoding and BOM.
First checks
python3 -c 'import csv;list(csv.reader(open("f.csv",newline="",encoding="utf-8-sig")))'— robust parseImport-Csv file.csv -Delimiter ';'— PowerShell- Don't split on commas manually — quoting
Verify in this order
CSV → library parser → validated records
Where it usually breaks
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5839