+

Generate Word, Excel, PowerPoint and PDF
with Gemini

Code

Python or TypeScript

Gemini decides. Doconda delivers the file.

Connect Doconda with Gemini function calling (@google/genai) and get finished, editable, reviewed Word, Excel, PowerPoint and PDF files.

  1. 01Install the SDKpip install doconda or npm install @doconda/sdk, and your API key.
  2. 02Give your agent the toolsDoconda's tools, in Gemini's format.
  3. 03Your agent delivers the fileYour agent gets the link to the reviewed file.
import { type Content, GoogleGenAI } from "@google/genai"
import { Doconda } from "@doconda/sdk"

const ai = new GoogleGenAI({})
const tools = new Doconda().tools()
const contents: Content[] = [{ role: "user", parts: [{ text: "Hazme un Excel con el presupuesto del evento" }] }]

while (true) {
  const res = await ai.models.generateContent({
    model: "gemini-3.8-flash",
    contents,
    config: { tools: [{ functionDeclarations: tools.map((t) => ({ name: t.name, description: t.description, parametersJsonSchema: t.inputSchema })) }] },
  })
  if (!res.functionCalls?.length) {
    console.log(res.text)
    break
  }
  contents.push(res.candidates![0].content!)
  const parts = await Promise.all(
    res.functionCalls.map(async (call) => ({
      functionResponse: { name: call.name, response: { result: await tools.find((t) => t.name === call.name)!.run(call.args ?? {}) } },
    })),
  )
  contents.push({ role: "user", parts })
}

FAQ

Common questions

01 / 03

How do I generate a Word file with the Gemini API?

Pass Doconda's tools as functions to @google/genai; when Gemini calls them, Doconda returns the link to the Word file and its PDF.

The document API for AI agents, ready for production.