Model chooser  /  Analyse spreadsheets and numbers  /  Recurring

For weekly reporting and text-to-SQL, use Gemini 3.8 Flash.

A reporting pipeline turns questions into queries and query results into a short narrative, many times a week. Gemini 3.8 Flash is Google's "most intelligent workhorse", sits in the low cost tier, and ranks level with Opus 5 on LMArena.

Why Gemini 3.8 Flash

The reasons it wins for this job.

  • Google positions 3.8 Flash as its "most intelligent workhorse model" for coding, agents and multi-step reasoning. Stable release 2 September 2026.
  • It ranks level with Claude Opus 5 and Muse Spark 1.3 on the LMArena text leaderboard of 13 September 2026, from the low cost tier.
  • JSON schema output returns the SQL, the chart spec and the narrative as separate fields, so your code can run the query before anything reaches a person.
  • It has a 1M-token input window and 65K output, so a full schema and a week of results fit without trimming.

How to use it

4 steps to a first result.

  1. 1Give it the schema and definitionsTable schemas plus your metric definitions (what counts as active, as churned). Keep them in a stable prefix.
  2. 2Generate SQL, run it yourselfThe model writes the query; your code runs it on a read-only connection with a row limit.
  3. 3Narrate from results, not guessesSend the query results back and ask for the three changes that matter, each tied to a number in the result.
  4. 4Keep a golden setTwenty questions with known correct answers. Run them on every prompt change.

Gemini API, TypeScript

Start from this.

Edit the parts in capitals, then run it.

import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({}); // reads GEMINI_API_KEY

const interaction = await ai.interactions.create({
  model: "gemini-3.8-flash",
  input: `Schema:\nPASTE SCHEMA\n\nMetric definitions:\nPASTE DEFINITIONS\n\nQuestion: Which acquisition channel had the best 90-day retention last quarter?`,
  response_format: {
    type: "text",
    mime_type: "application/json",
    schema: {
      type: "object",
      properties: {
        sql: { type: "string", description: "One read-only SELECT query" },
        assumptions: { type: "array", items: { type: "string" } },
      },
      required: ["sql", "assumptions"],
    },
  },
});

const { sql, assumptions } = JSON.parse(interaction.output_text);
// run sql on a READ-ONLY connection, then send the rows back for the narrative
Nothing is sent anywhere. It copies to your clipboard.

Alternatives that also work

If Gemini 3.8 Flash is not an option.

Claude Sonnet 5Official page →

Anthropic · closed · cost: medium

Pick it when the narrative quality matters as much as the query, such as a report that goes to the board.

DeepSeek V4.1 FlashHugging Face →

DeepSeek · open weights · cost: low · 391K HF downloads/mo

Pick it when volume is high and you want MIT-licensed weights with a cheap hosted API as a fallback.

Gemma 4 31BHugging Face →

Google · open weights · cost: free weights; you pay for the hardware · 9.1M HF downloads/mo

Pick it when the warehouse cannot be reached from a third-party API. Apache 2.0, one GPU.

Watch out for

Doing this just once? To analyse one spreadsheet, upload it to GPT-6 Astra in ChatGPT. A one-off analysis is a conversation: upload the file, ask, look at the chart, ask again. Astra is OpenAI's most capable model, it runs code on your file inside ChatGPT, and it ties for the top Intelligence Index score.

Sources

Checked . Models change monthly; we re-check this page when they do.

Picking the model is the easy part.

Wiring it into a workflow that runs every week, with evals, fallbacks and a cost you can predict, is the work. Fifteen minutes, no deck.

Book fifteen minutes →