=GPT_EXTRACT() — pull structured values out of messy text
=GPT_EXTRACT() reads a text and returns just the values you ask for, comma-separated. Where REGEXEXTRACT() needs a pattern, =GPT_EXTRACT() understands meaning — “company names”, “the price”, “the person’s role” — which makes it the go-to cleanup formula in GPT for Sheets.
Syntax
=GPT_EXTRACT(text, to_extract)
| Parameter | Required | Description |
|---|---|---|
text |
yes | The input text to extract from — usually a cell reference. |
to_extract |
yes | What to pull out, e.g. "email, country". Comma-separated values or a range. |
Examples
Get emails out of scraped “Contact us” text in A2 (lead list building):
=GPT_EXTRACT(A2, "email")
Pull company names from a LinkedIn bio:
=GPT_EXTRACT("I worked at Apple for 5 years and at Amazon for 3 years.", "companies")
Extract several fields at once from an order confirmation email in A2:
=GPT_EXTRACT(A2, "order number, total amount, delivery date")
Mine product specs from an e-commerce description:
=GPT_EXTRACT(A2, "material, color, weight")
Tips
- Multiple fields come back comma-separated — wrap the result with
SPLIT(cell, ",")to break them into columns. - If a field is missing from the text, the model may say so in words; add “return N/A if not found” style instructions via =GPT() when you need strict output.
- Drag the formula down to process a whole column — GPT for Sheets handles up to 10,000 results per hour.
- Finished extracting? Use Replace all GPT formulas with results in the sidebar to freeze the values.
Related functions
- =GPT_CLASSIFY() — put each row into one category
- =GPT_TAG() — apply multiple labels to a text
- =GPT_FORMAT() — convert between data formats
Try it
=GPT_EXTRACT() ships with GPT for Sheets — no API keys needed. Install the add-on from the Google Workspace Marketplace.