=GPT_FORMAT() — convert data between formats

=GPT_FORMAT() rewrites the same content in another format: HTML to JSON, Markdown to HTML, raw text to JSON-LD. The special target "table" splits the output across multiple cells. Part of GPT for Sheets.

Syntax

=GPT_FORMAT(input, target_format, [source_format])
Parameter Required Description
input yes The text to reformat — a string or a cell reference.
target_format yes Format to convert to: "html", "json", "json-ld", "markdown", "table", … "table" spills the output into multiple cells.
source_format no Format to convert from — usually auto-detected.

Examples

Turn scraped HTML in A2 into JSON for an import script:

=GPT_FORMAT(A2, "json", "html")

Convert an FAQ block into JSON-LD structured data for SEO:

=GPT_FORMAT(A2, "json-ld")

Convert a Markdown product description to HTML for your e-commerce CMS:

=GPT_FORMAT(A2, "html", "markdown")

Spread a blob of contact details across cells with the "table" target:

=GPT_FORMAT(A2, "table")

Tips

  • With target_format set to "table", keep the cells to the right and below empty — the result spills, and blocked cells cause #REF!.
  • Name the source_format when the input is ambiguous; it removes guesswork and stabilizes output.
  • Validate machine-readable outputs (JSON, JSON-LD) before shipping — AI formatting is a draft, not a parser.
  • Freeze the converted values with Replace all GPT formulas with results in the sidebar.

Try it

=GPT_FORMAT() ships with GPT for Sheets — no API keys needed. Install the add-on from the Google Workspace Marketplace.