Early-bird pricing (ends Dec 25), locked in while you stay subscribed: Go $10/mo (normally $20), Plus with Opus 5.5 just $30/mo (normally $50)Subscribe →

Gemini API Office Files: Upload docx, xlsx, pptx, Slice Costs

If you convert every workbook to CSV before calling the Gemini API, you can stop. Since November 18, 2026, the Gemini API accepts Word, Excel, and PowerPoint directly, and Google's wording is that you "process and pay only" for the slice you select (Google AI Studio changelog).

Savings require explicit selectors; otherwise the full file may still be processed, as reader @zg0820 notes.

Why the old Excel path broke

The older documented behavior read only the first worksheet as CSV, which forced reordering sheets or splitting workbooks:

"The docs still say only an XLSX's first sheet is read, as CSV." — @aitrackerbot

The November 18 entry replaces that workaround with direct Office and OpenDocument input plus slicing in prompts and function responses (DocsWatch analysis).

Gemini API changelog showing the November 18, 2026 Office files and content slicing entry

What the November 18 update actually changes

The entry adds two things on top of the November 5 expansion to PPT, ODP, and ODS:

  1. Direct Office and OpenDocument input. Word, PowerPoint, and Excel go in without PDF or text conversion.
  2. Content slicing. Select page ranges, worksheet tabs, A1 cell ranges, time intervals, or content layers such as page images, extracted text, formulas, and transcripts.

Slicing works in prompts and in FunctionResponse parts, so a tool can return a single sheet range instead of a whole workbook (AI Index summary).

Which files you can send now, and on which models

Firebase's input-requirements page, updated November 18, 2026 UTC, ties Office support to Gemini 4.x models (Firebase AI Logic docs):

FamilyExtensionsMIME type
Word.doc, .docx, .dotxapplication/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.wordprocessingml.template
PowerPoint.ppt, .pptxapplication/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation
Excel.xls, .xlsxapplication/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
OpenDocument.odt, .odp, .odsapplication/vnd.oasis.opendocument.text, application/vnd.oasis.opendocument.presentation, application/vnd.oasis.opendocument.spreadsheet
Baseline.pdf, .txtapplication/pdf, text/plain

Official limits (slicing does not raise them):

  • 50 MB per file, 1,000 pages per file, 3,000 document files per request.
  • 20 MB total request size for inline base64 data; larger files need Cloud Storage URLs.

Unverified community note, kept separate: one changelog reader reports an Office-specific ceiling around 2,000 pages or slides (@lawson_ste3476). Google has not documented it; do not design against it.

Word and PowerPoint: page ranges plus layer choice

DocumentMetadata was observed in public v1beta/v1alpha Discovery documents, absent from stable v1 (ORIENS schema report):

  • startPage: first page, 1-based, inclusive.
  • endPage: last page, 1-based, inclusive.
  • contentLayers: PAGE_IMAGE (rendered image; reported default when metadata is present but layers are empty) or PAGE_TEXT (extracted text).

Pick PAGE_IMAGE for layout, slides, and scanned pages; pick PAGE_TEXT for searchable text such as contracts. Firebase documents the underlying model: PDFs are treated as images with one page counting as one image, and images at or below 384 px on both sides cost 258 tokens (Firebase AI Logic docs).

Excel: sheets, cell ranges, and three layer modes

SpreadsheetMetadata attaches to the file part supplied via inline_data or file_data, in an input Part or FunctionResponsePart, per the Discovery schema (ORIENS schema report):

  • sheetIndex: 1-based workbook order. Discovery v1beta text says all sheets when omitted; Python and JavaScript SDK text says first sheet. Set it every time.
  • visibleCells: A1 range such as A1:G35; omitted means the occupied area of the selected sheet.
  • contentLayers: DATA (values, merges, formatting), FORMULAS (expressions plus computed results), VISUAL (rendered image). Reported default is [DATA, FORMULAS].

For audits use DATA plus FORMULAS; for layout and merged-cell context add VISUAL; for a single lookup keep the tightest visibleCells range.

Send only the slice: Python REST example

Field names below match Discovery revision 20261116; the shape is beta and missing from stable v1, so verify against your installed SDK before production use.

python
import os
from google import genai
import requests

client = genai.Client()  # reads GEMINI_API_KEY
workbook = client.files.upload(
    file="q3_revenue.xlsx",
    config={"mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},
)

api_key = os.environ["GEMINI_API_KEY"]
url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-4-hydrogen:generateContent?key={api_key}"
payload = {
    "contents": [{
        "parts": [
            {
                "fileData": {
                    "fileUri": workbook.uri,
                    "mimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                },
                "spreadsheetMetadata": {
                    "sheetIndex": 2,
                    "visibleCells": "A1:G35",
                    "contentLayers": ["DATA", "FORMULAS"],
                },
            },
            {"text": "Summarize revenue variance in this range using computed values."},
        ]
    }]
}
r = requests.post(url, json=payload, timeout=120)
r.raise_for_status()
print(r.json()["candidates"][0]["content"]["parts"][0]["text"])

Word swaps in "documentMetadata": {"startPage": 12, "endPage": 18, "contentLayers": ["PAGE_TEXT"]} with the .docx MIME type. PowerPoint uses the same documentMetadata shape with the .pptx MIME type and slide page numbers.

The billing math: when slicing actually saves money

There is no separate slicing SKU in the changelog or Firebase pricing notes; savings equal avoided input tokens at standard rates. The changelog records gemini-4-hydrogen at $1.50 per 1M input tokens.

Illustrative estimate for a 200-page report where only pages 12–18 matter (the 800-token-per-text-page figure is an assumption for this example, not a documented rate):

  • Before: 200 pages as images x 258 tokens minimum per page-image = 51,600 input tokens. Cost: 51,600 / 1,000,000 x $1.50 = $0.0774.
  • After: 7 pages as extracted text x assumed 800 tokens = 5,600 input tokens. Cost: 5,600 / 1,000,000 x $1.50 = $0.0084.
  • Saving: about 89% on input for this request, before output tokens. Substitute your measured page density.

Benchmark range size on your own workbook: many tiny sliced calls may total more than one well-chosen range (@zg0820).

Make it stick: verification and migration checklist

An upload succeeding does not prove parsing succeeded. Verify each pipeline:

  1. Prove parsing. Ask back for row count, sheet name, or page count and compare with the source.
  2. Set every selector. sheetIndex, visibleCells or page range, and contentLayers.
  3. Match layer to question. Charts and layout need VISUAL or PAGE_IMAGE; audits need DATA plus FORMULAS; search needs PAGE_TEXT.
  4. Probe out-of-range behavior in staging. The schema does not specify whether an invalid page or range errors, clamps, or returns nothing.
  5. Respect upload ceilings. A 60 MB file still fails a 50 MB limit. Use Cloud Storage URLs over 20 MB inline.
  6. Migrate in this order. Excel splitters to sheetIndex plus visibleCells; report rasterizers to page ranges with PAGE_TEXT (reserve PAGE_IMAGE for layout); whole-file tool returns to sliced function responses.

What the cited sources leave unspecified: handling for hidden rows, merged cells, charts, embedded images, and password-protected, macro-enabled, or corrupted files is not stated in the slicing announcement or the Firebase input-requirements page linked above. Verify those on your own templates.

FAQ

Can I slice content inside function responses too?

Yes. Tools can return a file URI plus SpreadsheetMetadata or DocumentMetadata so the model sees only the excerpt, which suits agent document workflows.

Which API version supports slicing?

Observed in v1beta and v1alpha Discovery revision 20261116, not stable v1. Pin versions and test on your target model before production.

Why does Gemini say it can't see my uploaded file?

Check MIME type, size, and explicit selectors against the table and limits above, then ask the model to echo sheet names or page counts to confirm parsing.

Related reading: Gemini 4 Carbon vs Hydrogen API guide for choosing the model behind an Office pipeline.