{"slug": "gemini-api-file-slicing-read-only-the-part-of-a-file-you-need", "title": "Gemini API File Slicing: Read Only the Part of a File You Need", "summary": "Google announced file slicing controls for the Gemini API on 23 Nov 2026, letting developers send only selected pages, sheets or content layers of a document and pay tokens only for the parts Gemini inspects, according to the Gemini API changelog entry dated 18 Nov 2026. Developers enable slicing by setting a `processing` object with `type` set to `static` on a document block, using `page_options` fields such as `start_page`, `end_page` and `content_layers`; the docs price a page image at about 280 tokens at low resolution, 560 at medium and 1,120 at high on Gemini 4 and Gemini 3 models, versus a flat 258 tokens per page on Gemini 2.5 models. Google's post says the feature removes the need for agents to run \"LibreOffice, PDF renderers, and ffmpeg inside the client harness to render and slice large files.", "body_md": "# Gemini API File Slicing: Read Only the Part of a File You Need\n\nAdd a processing object to a Gemini API document block to send only chosen pages, sheets or layers, and Gemini bills just that slice. Checked 1 Dec 2026.\n\nGemini API file slicing lets you send part of a file, such as chosen pages, sheets and content layers, instead of the whole thing. [Google says](https://blog.google/innovation-and-ai/technology/developers-tools/file-slicing-controls/) it bills “tokens only for the parts Gemini inspects.” You turn it on with a `processing` object, `type` set to `static`, on a document block. Checked 1 Dec 2026.\n\n## What is Gemini API file slicing? [#](#what-is-gemini-api-file-slicing)\n\nIt is a set of request fields that tell Gemini which part of a file to read. Google announced it in “[Introducing file slicing controls in the Gemini API](https://blog.google/innovation-and-ai/technology/developers-tools/file-slicing-controls/)” on 23 Nov 2026, with direct upload of Microsoft Office and OpenDocument files. The post says you can “request only the pages, spreadsheet cells, media segments, and layers you need.”\n\nThe [Gemini API changelog](https://ai.google.dev/gemini-api/docs/changelog) lists it on 18 Nov 2026 as “Multimodal file processing and slicing”, so you “only process and pay for the content you need.” The post says that when model APIs only take whole files, agents end up running “LibreOffice, PDF renderers, and ffmpeg inside the client harness to render and slice large files.” With slicing, the API does that work on Google’s side. The idea is simple: read only the part of a file you need.\n\n## How do you slice pages of a PDF, Word file or deck? [#](#how-do-you-slice-pages-of-a-pdf-word-file-or-deck)\n\nSet `processing.page_options` on the document block. The [document understanding docs](https://ai.google.dev/gemini-api/docs/document-processing#customize-document-processing), read 1 Dec 2026, list these options, all optional:\n\n- `start_page` and`end_page` : the first and last page to include, counted from 1, inclusive.\n- `content_layers` :`page_image` for rendered pages,`page_text` for extracted text, or both. It defaults to`page_image` when`processing` is set.\n- `resolution` : set on the outer document block to`low` ,`medium` (the default) or`high` .\n\nThis is the docs’ Python example. It sends pages 3 through 7 of a PDF, five pages, as page images at high resolution:\n\n``` python\nfrom google import genai\n\nclient = genai.Client()\n\nuploaded_doc = client.files.upload(file=\"quarterly_report.pdf\")\n\ninteraction = client.interactions.create(\n    model=\"gemini-4-hydrogen\",\n    input=[\n        {\n            \"type\": \"document\",\n            \"uri\": uploaded_doc.uri,\n            \"mime_type\": \"application/pdf\",\n            \"resolution\": \"high\",\n            \"processing\": {\n                \"type\": \"static\",\n                \"page_options\": {\n                    \"start_page\": 3,\n                    \"end_page\": 7,\n                    \"content_layers\": [\"page_image\"],\n                },\n            },\n        },\n        {\n            \"type\": \"text\",\n            \"text\": \"Summarize the revenue bridge chart and footnotes on pages 3 through 7.\",\n        },\n    ],\n)\n\nprint(interaction.output_text)\n```\n\n## What does each page cost in tokens? [#](#what-does-each-page-cost-in-tokens)\n\nOn Gemini 4 and Gemini 3 models, the docs put a page image at about 280 tokens at low resolution, 560 at medium or 1,120 at high. Gemini 2.5 models use a “Flat 258 tokens per page.” The docs’ tip: “scan with `page_text` first. Then request `page_image` at `high` resolution only for pages with charts or dense layouts.” Google’s post calls this “Skim cheap, then zoom in.”\n\n## How do you slice a spreadsheet? [#](#how-do-you-slice-a-spreadsheet)\n\nSet `processing.spreadsheet_options`. The docs list `sheet_index` for the worksheet position in tab order, `visible_cells` for a cell or range in A1 notation such as A1:G40, and `content_layers`: `data` for evaluated values, `formulas` for raw formulas and `visual` for a rendered snapshot of charts and layout. The default layers are `data` and `formulas`. The docs’ Python example:\n\n``` python\nfrom google import genai\n\nclient = genai.Client()\n\nworkbook = client.files.upload(file=\"financial_model.xlsx\")\n\ninteraction = client.interactions.create(\n    model=\"gemini-4-hydrogen\",\n    input=[\n        {\n            \"type\": \"document\",\n            \"uri\": workbook.uri,\n            \"mime_type\": \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n            \"resolution\": \"high\",\n            \"processing\": {\n                \"type\": \"static\",\n                \"spreadsheet_options\": {\n                    \"sheet_index\": 2,\n                    \"visible_cells\": \"A1:H50\",\n                    \"content_layers\": [\"data\", \"formulas\", \"visual\"],\n                },\n            },\n        },\n        {\n            \"type\": \"text\",\n            \"text\": \"Audit the EBITDA formulas and chart in Sheet 2 (A1:H50).\",\n        },\n    ],\n)\n\nprint(interaction.output_text)\n```\n\n## Can an agent pick the slice itself? [#](#can-an-agent-pick-the-slice-itself)\n\nYes: your tools can return a sliced file inside a `function_result` block. The [function calling docs](https://ai.google.dev/gemini-api/docs/function-calling#file-inspection-options) say tools return “sliced pages, spreadsheet ranges, or media clips” with the same `processing` and `resolution` fields, and the model gets page counts and worksheet names “automatically so it can request narrower ranges on later turns.”\n\nThe docs example wraps this in a tool named `inspect_document_pages`.\n\nVideo works the same way: the [video docs](https://ai.google.dev/gemini-api/docs/video-understanding#customize-video-processing) list `start_offset`, `end_offset`, `fps` and `content_layers` (`frames`, `audio` or `transcript`). Google’s post gives audio the same clipping.\n\n## How is a sliced file billed? [#](#how-is-a-sliced-file-billed)\n\nOnly for the part you send. The docs say “Gemini counts and bills tokens only for the slice you send.” Under Sliced billing they count only “the selected pages, sheets, and content layers sent to the model.”\n\nThe [pricing page](https://ai.google.dev/gemini-api/docs/pricing), read 1 Dec 2026, has no line on slicing itself. It says “Tokens for the `DOCUMENT` modality (for example, PDFs) are billed at the image token rate.” On 1 Dec 2026 its Standard tab lists [Gemini 4 Hydrogen](https://munderdiffl.in/blog/gemini-4-hydrogen/), the model in the docs examples, at $1.50 per 1M input tokens in USD on the paid tier.\n\n## Which models and files does it support? [#](#which-models-and-files-does-it-support)\n\nGemini 3 and Gemini 4 models, per the docs; Google’s post says it “works across all Gemini 4 models.” Each cell below was read on 1 Dec 2026 from the page named.\n\n| Feature | What Google says | Status | Models | File types | Billing | \n|---|---|---|---|---|---|\n| `page_options` | “Select a page range” (post) | “available today” (post, 23 Nov 2026) | Gemini 3 and Gemini 4 (docs) | PDF, Office and OpenDocument documents and slides | Selected pages and layers only (docs) | \n| `spreadsheet_options` | “Select a worksheet tab” (post) | “available today” (post) | Gemini 3 and Gemini 4 (docs) | .xlsx, .xls, .ods | Selected sheets and layers only (docs) | \n| Video clipping | “Clip time intervals” (post) | “available today” (post) | All Gemini 4 (post) | Video | Clipped interval and layers only (video docs) | \n| Office file input | “native file upload support” (post) | Changelog, 18 Nov 2026; no Preview label | Gemini 4, Gemini 3 and 2.5 (docs) | .docx, .doc, .dotx, .odt, .pptx, .ppt, .odp, .xlsx, .xls, .ods | Image token rate for DOCUMENT tokens (pricing) | \n\nLimits stay the same. The docs allow up to 50 MB per file, 1,000 pages per PDF, or 2,000 pages or slides per Office or OpenDocument file, and these apply “to the full uploaded file even when slicing.” Spreadsheets take up to 50,000 cells per sheet.\n\n## Who gets the most from file slicing? [#](#who-gets-the-most-from-file-slicing)\n\nWe think slicing helps most when you write the agent code yourself, since it is a field in API requests. [Munder Difflin](https://harnessmd.com/download) is free and open source: a desktop app that runs a team of AI agents for all kinds of knowledge work, coding included, on your own computer. Its [README](https://github.com/HarnessMD/munder-difflin), read 1 Dec 2026, lists Gemini CLI as an engine and says “Each agent picks its own, so one office can mix them.” It adds: “Each agent runs the real CLI you already use, signed in with your own plan.” Our [what is Gemini CLI](https://munderdiffl.in/blog/what-is-gemini-cli/) explainer covers that engine, [how to install and use Munder Difflin](https://munderdiffl.in/blog/how-to-install-and-use-munder-difflin/) covers setup, and more how tos sit in our [Guides hub](https://munderdiffl.in/blog/topics/guides/).\n\n## FAQ\n\nWhat is Gemini API file slicing?\n\nA way to send the Gemini API only part of a file: a page range, a worksheet tab, a cell range, a video clip or a content layer. Google announced it on 23 Nov 2026 and says it bills \"tokens only for the parts Gemini inspects.\"\n\nHow do I turn on file slicing?\n\nAdd a processing object with type set to static on a document block, then set page_options for PDFs, documents and slides, or spreadsheet_options for workbooks. The docs, read 1 Dec 2026, say all these fields are optional.\n\nWhich models support Gemini file slicing?\n\nThe document understanding docs, read 1 Dec 2026, say Gemini 3 and Gemini 4 models support these options in user inputs and tool results. Google's post of 23 Nov 2026 says it works across all Gemini 4 models.\n\nCan I send Word, PowerPoint and Excel files to the Gemini API?\n\nYes. The docs list .docx, .doc, .dotx, .odt, .pptx, .ppt, .odp, .xlsx, .xls and .ods. The limits are 50 MB per file and 2,000 pages or slides per Office or OpenDocument file, and they apply to the full uploaded file even when slicing.\n\nHow is a sliced file billed?\n\nOnly for what you send. The docs say \"Gemini counts and bills tokens only for the slice you send.\" The pricing page, read 1 Dec 2026, says tokens for the DOCUMENT modality are billed at the image token rate.", "url": "https://wpnews.pro/news/gemini-api-file-slicing-read-only-the-part-of-a-file-you-need", "canonical_source": "https://munderdiffl.in/blog/gemini-api-file-slicing/", "published_at": "2026-12-01 00:00:00+00:00", "updated_at": "2026-12-01 17:15:23.885524+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-products", "ai-tools", "ai-agents"], "entities": ["Google", "Gemini API", "Gemini 4", "Gemini 3", "Gemini 2.5", "Microsoft Office", "OpenDocument"], "also_reported_by": [], "takeaway": "Set `processing.type` to `static` with `page_options.start_page`/`end_page` and `content_layers` to bill only the selected pages, and scan with `page_text` first before requesting `page_image` at high resolution, which costs about 1,120 tokens per page versus 280 at low.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/gemini-api-file-slicing-read-only-the-part-of-a-file-you-need", "markdown": "https://wpnews.pro/news/gemini-api-file-slicing-read-only-the-part-of-a-file-you-need.md", "text": "https://wpnews.pro/news/gemini-api-file-slicing-read-only-the-part-of-a-file-you-need.txt", "jsonld": "https://wpnews.pro/news/gemini-api-file-slicing-read-only-the-part-of-a-file-you-need.jsonld"}}