Check a CSV safely on your computer
Count rows and blank cells without uploading private business data. A read-only Python standard-library command for technical operators who know where their file is stored.
python3 -c '
import csv
from collections import Counter
from pathlib import Path
p = Path(input("Enter full path to your CSV: ").strip()).expanduser()
if not p.is_file() or p.suffix.lower() != ".csv":
raise SystemExit("Not an existing .csv file. Nothing changed.")
with p.open("r", encoding="utf-8-sig", newline="") as f:
reader = csv.DictReader(f)
columns = reader.fieldnames or []
missing = Counter()
total = 0
for row in reader:
total += 1
for col in columns:
if not (row.get(col) or "").strip():
missing[col] += 1
print("Rows:", total)
print("Columns:", ", ".join(columns))
print("Blank counts per column:", dict(missing))
print("Done. File was read, not modified.")
'How to do it
- Use macOS Terminal or Linux Bash with Python 3 installed; this command is not for Windows PowerShell.
- Create or choose an ordinary CSV (not Excel XLSX) file; keep a backup if using business records.
- Copy the complete command, paste into Terminal and press Enter.
- When asked, type the full path to the local CSV file. Only row counts and missing-field totals are printed.
Example starting point
A fictional spreadsheet export with three rows and columns reference, status and owner. One owner field is blank.
Example result
Rows: 3
Columns: reference, status, owner
Blank counts per column: {owner: 1}
Done. File was read, not modified.Before you use it
Runs entirely on your computer. Never paste credentials, personal customer values or CSV contents into an AI service. Command reads a file but does not modify or transmit it.
Tested concept uses Python standard library and a Bash heredoc. It does not work directly in Windows PowerShell. Stop with Ctrl+C; no persistent changes.
Alternative: Open the CSV in LibreOffice or Google Sheets and inspect column headers and blank counts manually.
When this needs a reliable team handoff, read Business Workflow Automation & Integrations or discuss a scoped First Fix Sprint.
Need a repeatable system? Ask Nocular about implementing this workflow.