how it works

How does Sheet2SQL work?

Sheet2SQL is an AI agent-workflow hybrid that extracts data and logic from spreadsheets.

  • An agent provides enough freedom to explore, make mistakes, and recover from them.
  • A workflow adds guardrails to keep the process token efficient, structured, and predictable.

Steps

The following is a simplification of the steps that the agent takes:

  1. 1

    Read

    Read all values and formulas from the workbook, sampling sheet data efficiently to reduce token usage and latency.

    Generate screenshots of the sheets for visual understanding, since formatting often encodes semantics (bold, italics, borders, alignment, spacing...)

  2. 2

    Understand

    Explore the sheets to understand their structure and layout. Classify everything into two buckets:

    • Tables, which contain raw and computed columns.
    • Single values, which can be standalone, isolated cells, but also cells that appear within/next to a table range.

    Raw values/columns are inputs. Computed values/columns are the result of data manipulations on the raw inputs, and are verified.

  3. 3

    Tidy

    Transform the tables following Hadley Wickham's definition of tidy data. Define and check expectations about the tidy tables that must hold true.

  4. 4

    Model

    Build a dependency graph of all original and tidy objects in the spreadsheet (values, tables, formulas).

  5. 5

    Translate

    Generate SQL queries that reproduce the data manipulations in the original file (for computed columns in tables and computed single values)

  6. 6

    Verify

    Run all SQL queries to verify that all computations are correct.

Try it out

Drag-and-drop the sales.xlsx demo file in sheet2sql.com and click Generate SQL to see the agent in action.

Want to try it out with your own spreadsheets? Send an email to contact@sheet2sql.com to join the private beta.