Introduction

As the name suggests,=EXTRUCT_LLM() is a function that calls LLM. Always prefer this function over =EXTRUCT() if you do not need to research the information but want to apply LLMs on top of the content that already exists in your spreadsheet.

Syntax

// Full syntax
=EXTRUCT_LLM(prompt, llmModel, outputFormat)

// Equivalent to =EXTRUCT_LLM(prompt, llmModel, "text")
=EXTRUCT_LLM(prompt, llmModel)

// Equivalent to =EXTRUCT_LLM(prompt, "gpt3", "text")
=EXTRUCT_LLM(prompt)
ParameterValueDescription
promptstringPrompt to the LLM.
llmModelgpt3, gpt4o-mini, gpt4o, haiku, sonnet35Which LLM model to use. We support both OpenAI and Anthropic. The default is gpt4o-mini.
outputFormat"text", "url", "number", or a list of output valuesOutput Format. The default is text, which means no additional formatting is applied to the result. If a list of values is passed (e.g. {"private", "public"}), Extruct will select one of the provided values for the answer. You can provide custom formatting instructions directly in prompt.
To include context into the prompt, use the concatenation & operator.

Example: "Based on the company product overview, describe its UVP as a list of bullets. Product overview: " & A1

Examples

NameFormula
Normalize Company Name=EXTRUCT_LLM("Based on a company name, return normalized (as if written by human) version of the name I can use for the email. Company Name: " & A1)
Email Icebreaker=EXTRUCT_LLM("Based on person's LinkedIn profile data, summarize its work & education background as a bulleted list of one-liners. Linkedin data: " & A1, "sonnet35")
Data Categorization=EXTRUCT_LLM("Given company revenue information, categorize it into one of the revenue range buckets. Company revenue: " & A1, "haiku", {"less than $10 million", "more than $10 million"})

Output Formats

Identical to =EXTRUCT().

Supported LLM models

At the moment, we support the following models:

ProviderModel NamellmModel value
OpenAIGPT3.5gpt3
OpenAIGPT4o Minigpt4o-mini
OpenAIGPT4ogpt4o
AnthropicHaiku 3haiku
AnthropicSonnet 3.5sonnet35

We do not support the most expensive models, such as OpenAI GPT-4 Turbo and Anthropic Opus, for two reasons:

  1. They incur massive costs when running LLMs for many rows.
  2. GPT4o or Sonnet 3.5 performs exceptionally well for most practical tasks.

Our Recommendation

  • Start with the default
  • Sonnet 3.5 for sophisticated content generation tasks (e.g., personalized email generation)
  • Haiku 3 or Sonnet 3.5 for extremely long inputs (hundreds of words)
  • Haiku 3 or Sonnet 3.5 for tasks where some level of reasoning is involved (e.g., categorize numerical input into buckets)