When is Gemini API file slicing worth using?

YYSI publication · Source announcement · Updated

If your app already knows which page, spreadsheet range, or clip a user needs, Gemini API file slicing gives you a way to send Gemini directly to that part of an uploaded file. Whether it pays off depends on where the answer lives. A question tied to a cell range is a good candidate. A monthly report that asks you to reconcile figures across several tabs still needs broader coverage. To decide, compare the cost and accuracy of the completed task, including any requests needed to recover missing context.

What Google changed

Google announced server-side slicing for Gemini 4 models on November 23, alongside native file upload support for Office and OpenDocument formats. An app can upload a file with the Files API, then reuse its URI while requesting selected pages, spreadsheet cells, or media intervals. Which settings are available depends on the file type. For documents, Google describes a page range and a choice of text or page images. For spreadsheets, it describes tab and cell selection and access to values, formulas, and visuals. Existing file size and page limits still apply.

In Google’s example, the app skims a Word document’s text and then requests a higher-resolution look at a specific page. That pattern is useful when most of a file is easy to search but the answer depends on a chart, a layout, or a footnote. It also means two calls contribute to the cost of answering the question.

Sources · Google’s worked example · Gemini document processing guide

Choose the scope based on the question

Extract fields from a supplier invoice. Read the page containing the totals and the line items. Retain the page reference in the result. Include later pages for credits, taxes, or line items continued after a page break.

Explain a cell in a financial workbook. Inspect the selected range with formulas. Check the value and formula as separate fields. Include precedent cells and referenced sheets before drawing a conclusion about the calculation.

Summarize a long report. Read the table of contents and relevant sections, then compare the outline with the whole report. Include appendices or use broader input when the reader expects complete coverage.

These are suggested workflows. The invoice example shows why choosing the first page by default is fragile. A model can accurately transcribe everything it was shown and still return the wrong overall total if a credit note or continuation page was outside the slice. In an extraction tool, return the pages or ranges used and route incomplete responses to a wider pass. That gives the app a way to recover and gives a reviewer something to check.

Workbooks can be harder to scope than PDFs. A range that looks self-contained on screen can depend on another tab. Include a test case where the same displayed number has two possible explanations and only the referenced cells resolve which one is correct. If your app cannot locate those dependencies, a wider request may give you more reliable answers on that workflow.

Compare a full read, a direct slice, and a two-step read

Use several public or synthetic files that resemble your workload. Include a clean document, a scanned document, and a file with an answer split across two pages or tabs. Manually record the expected answer and its location before calling the model.

Full read. Give the model the whole file and record the answer, where the model says it found it, elapsed time, and reported usage.

Direct slice. Keep the model, instructions, and output format fixed. Supply the range your app would have selected using the information it has at request time. Record wrong ranges and any requests needed to recover.

Skim, then inspect. Use a broader pass to identify a candidate range, then make a focused request. Add the timing and usage of both calls and include any retries.

Score each run on the required fields and whether the cited page or cells support the answer. Record answers that look plausible but miss evidence outside the range. If a focused request is faster on simple files but introduces more mistakes on multi-page files, use the narrower route for the simple cases and keep a broader path for the rest. This evaluation design is YYSI analysis. YYSI did not run these API tests for this article.

Estimate cost per accepted answer

Google says that slicing charges tokens for the file content Gemini inspects. Your total still depends on all requests and the applicable input, output, and other rates. Keep the full-read and sliced workflows on the same model and billing tier for comparison. Google’s Interactions API documentation describes usage fields for input, output, thinking, cached content, and tools. Use the response’s usage and the current rate card for your model. Google’s Developer API pricing notes that PDF document-modality tokens use the image-token rate.

For each approach, sum the charges for every attempt, including retries and broader follow-up calls, then divide by the number of answers that passed your checks. Track upload time separately from generation time so you can see whether repeated uploads are a material part of your workflow. If you reuse file URIs in a job queue, account for Google’s documented 48-hour Files API retention and handle an expired file reference.

Start with a question whose location your app can identify from the user’s request, such as a named worksheet and cell range. A fair trial compares the money and time spent on answers you can use, along with the mistakes each approach makes.

Sources · Token usage documentation · Gemini API pricing · Files API retention and deletion · Google’s announcement

Related resources

Official announcement ↗ · Read the news brief

AI-assisted analysis with linked sources. Evaluation steps are proposed, and no YYSI test results are reported. Editorial standards