Convert a Markdown Table to CSV or JSON with Row and Column Validation

You get a clean CSV or JSON conversion of your Markdown table, plus a row-and-column count check that flags any ragged rows.

Text prompt for ChatGPT and Claude

Prompt

Prompt
Act as a data formatting specialist. Your job is to convert a Markdown table I paste into clean CSV or JSON, while verifying that no data is lost or misaligned.

First, ask me two short questions in one message and wait for my reply:
1. Do you want CSV or JSON output?
2. Should empty cells be kept as empty strings or null?

Once I reply and paste my Markdown table, follow these rules:
- Strip Markdown pipe characters, alignment rows (such as --- or :---:), and leading or trailing whitespace from every cell.
- Count the columns in the header row and check every data row against that count. Flag any ragged rows that have fewer or more cells than the header.
- For CSV, wrap any cell containing commas, quotes, or line breaks in double quotes, and escape internal double quotes by doubling them.
- For JSON, output an array of objects using the header names as keys, preserving the original row order.
- Do not invent missing values or silently drop extra cells.

Output format:
1. Validation Summary (input rows, output rows, expected columns, and a list of any ragged rows by row number)
2. Converted Output (inside a fenced code block)

End with one line noting any assumptions made about headers, data types, or ragged rows.

Example output

Example for: a product manager converting a 6-row feature-release Markdown table into CSV with empty cells kept as empty strings.

1. Validation Summary
  • Input data rows: 6 (excluding header and alignment row)
  • Output data rows: 6
  • Expected columns: 4 (Feature, Owner, Target Date, Notes)
  • Ragged rows flagged: Row 4 has 3 cells instead of 4 (missing Notes column); Row 6 has 5 cells instead of 4 (extra trailing cell Needs QA).
2. Converted Output
Feature,Owner,Target Date,Notes
SSO Login,Maya Lin,2026-12-01,"Requires Okta, Azure AD"
Audit Log Export,Devon Park,2026-12-08,CSV and JSON formats
Role Permissions,Samira Patel,2026-12-15,
Bulk User Import,Maya Lin,2027-01-05,Supports up to 5000 rows
Webhook Retries,Devon Park,2027-01-12,Exponential backoff
Billing Alerts,Samira Patel,2027-01-19,"Slack, Email",Needs QA

Assumptions: Row 4 was padded with a trailing empty cell to match the 4-column header, and Row 6 retained its extra fifth cell so no text was dropped.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Forces a column-count check against the header so ragged rows are caught before import.
  • Specifies exact CSV quoting rules for commas and double quotes to prevent broken columns.
  • Prohibits inventing missing values or silently dropping extra cells.

Use this in ChatGPT, Claude, or Gemini when moving Markdown tables from docs or AI chats into spreadsheets or scripts. Have your Markdown table ready to paste.

Common edits

  • Ask for semicolon-delimited or tab-separated output instead of comma-separated CSV.
  • Add a rule to convert header names to snake_case when outputting JSON.

Reuse it: Use in a workflowTurn into a skillAdapt in the builder

More in Data Analysis
Data Analysis

Classify Customer Reviews by Sentiment and Topic with Verbatim Quotes

Get a summary count table of your customer reviews grouped by topic and sentiment, paired with one verbatim quoted example for each topic.

Data Analysis

Clean Copy-Pasted PDF Text Without Changing Original Wording

Get clean, readable text from messy PDF copy-pastes with broken lines, split hyphens, and stray headers removed while keeping the original wording.

Data Analysis

Plan Dataset Anonymisation with a Column-by-Column Action Table

Get a column-by-column anonymisation plan specifying whether to drop, mask, bucket, or keep each field before sharing data externally.

Data Analysis

Redact Personal Information with Consistent Tokens and an Audit Log

Get your pasted text back with personal details replaced by consistent typed tokens, plus a separate audit table showing every masked item.

Data Analysis

Turn Voice-Memo Transcripts into Decisions, Actions, and Questions

You get clean, structured notes from a rambling voice-memo transcript, sorted strictly into verified decisions, action items with owners, and open questions.

Data AnalysisClaude

Spec and Build a Weekly KPI Dashboard in Claude Data

Get a checked weekly KPI dashboard spec with exact definitions, visible queries, week-over-week comparisons, RAG rules and a data checks panel, then the build.