User Rating 0.0
Total Usage 0 times

Sheet must be published via File → Publish to Web

Is this tool helpful?

Your feedback helps us improve.

About

Markdown tables are notoriously tedious to write by hand. A misaligned pipe character or a missing separator row breaks the entire render. This tool converts published Google Spreadsheets or raw CSV/TSV data into properly formatted Markdown tables with correct column alignment. It fetches data directly from Google's public CSV export endpoint, parses it with full RFC 4180 compliance (handling quoted fields, escaped double-quotes, and embedded newlines), then generates a pretty-printed table with padded columns. It also auto-detects numeric columns and applies right-alignment via the : separator syntax. Note: the source spreadsheet must be published to the web via File → Publish to Web. Private or restricted sheets cannot be accessed from a browser without OAuth.

google sheets markdown table converter csv to markdown spreadsheet markdown table google docs data conversion

Formulas

The converter constructs a GFM-compliant Markdown table following this structure pattern:

| H1 | H2 | | Hn |
| sep1 | sep2 | | sepn |
| C1,1 | C1,2 | | C1,n |

Where Hi is the header cell for column i, sepi is the separator which controls alignment: :--- for left, ---: for right, :---: for center. Cr,i is the cell content at row r, column i. Column width Wi is calculated as:

Wi = max(len(Hi), maxr(len(Cr,i)), 3)

The minimum width of 3 ensures valid separator syntax. Pipe characters (|) within cell content are escaped to \| before width calculation. Numeric detection uses the pattern: a column is right-aligned if 60% of its non-empty body cells match /^[\-+]?[\d,._]+[%]?$/.

Reference Data

FeatureDetails
Google Sheets URLExtracts sheet ID via regex, fetches CSV from docs.google.com/spreadsheets/d/{id}/export?format=csv
Multi-sheet supportAppend &gid= parameter to select specific sheet tab
CSV ParsingRFC 4180 compliant: quoted fields, escaped quotes (""), embedded newlines
TSV SupportAuto-detects tab-delimited data when no commas found
Column AlignmentAuto-detects numeric columns → right-align (---:), text → left-align (:---)
Pretty PrintPads cells to uniform column width for source readability
Compact ModeOutputs minimal Markdown without padding for smaller file size
Header RowFirst row always treated as <thead>
Empty Cell HandlingPreserves empty cells as whitespace between pipes
Pipe EscapingLiteral | in cell content escaped as \|
Newline HandlingEmbedded newlines in cells replaced with <br> tags
Max ColumnsNo limit. Horizontal scroll on preview for wide tables
Max RowsTested up to 10,000 rows without performance issues
Output FormatsCopy to clipboard or download as .md file
PersistenceLast input URL and settings saved to localStorage
Markdown SpecGitHub Flavored Markdown (GFM) table syntax
Error RecoveryGraceful fallback for CORS errors, invalid URLs, empty sheets

Frequently Asked Questions

The spreadsheet must be published to the web. In Google Sheets, go to File → Share → Publish to web, select the sheet tab, choose CSV format, and click Publish. The sharing setting must also be at least "Anyone with the link can view". Private sheets cannot be fetched from a browser without server-side OAuth. If you see a CORS error despite publishing, try pasting the spreadsheet data directly as CSV instead.
Pipe characters (|) in cell content are escaped as \| to prevent breaking the Markdown table structure. Commas within quoted CSV fields are parsed correctly per RFC 4180. Embedded newlines within cells are replaced with
HTML tags, which most Markdown renderers (including GitHub) support inside table cells.
Yes. Append the gid parameter to the URL. Each sheet tab has a unique gid visible in the URL when you select it (e.g., #gid=123456789). The converter extracts this parameter and includes it in the CSV export request. If no gid is specified, the first (default) sheet is fetched.
The converter scans all non-empty body cells (excluding the header) in each column. If 60% or more of them match a numeric pattern (digits with optional sign, commas, decimals, or trailing percent), the column is right-aligned using the :--- separator. Otherwise it defaults to left-alignment. You can override this by manually editing the separator row in the output.
There is no hardcoded limit. The tool has been tested with tables up to 10,000 rows and 50 columns without performance degradation. However, Google's CSV export endpoint may truncate extremely large sheets. For very large datasets, consider exporting as CSV from Google Sheets directly and using the paste or file upload input method.
Pretty Print pads every cell with spaces so that pipe characters align vertically across all rows. This makes the raw Markdown source readable in a text editor but increases file size. Compact mode removes all padding, outputting the minimum valid syntax. Both render identically in any Markdown parser. Use Compact for programmatic consumption and Pretty Print for human-readable documentation.