Skip to main content
Declare doconda.tools() as Gemini functions on Vertex AI. When you ask for a spreadsheet, Gemini calls create_document with format: "xlsx", and you get an Excel file with real formulas and its PDF, with their download links.

Generate a spreadsheet from Gemini

  1. Authenticate with Google Cloud (gcloud auth application-default login or a service account) in a project with Vertex AI enabled.
  2. Put your Doconda API key (dashboard → API keys) in DOCONDA_API_KEY.
  3. Declare the tools and run the loop: while Gemini asks for functions, run them and send back the result.
Both print Gemini’s reply with the .xlsx and PDF links. parameters_json_schema (parametersJsonSchema in @google/genai) takes each tool’s JSON Schema as is.

What you get back

  • An Excel file with real formulas (not pasted numbers), the assumptions in their own cells and no calculation errors, plus its PDF.
  • status: ready or failed. A failed document isn’t charged.
  • Links expire after 5 minutes; Gemini gets fresh ones with get_document.

FAQ

Yes, the same code without vertexai=True, with a Gemini API key. See Gemini.
Yes. Gemini uploads your files with upload_file and passes them as sources: up to 5 documents (Word, PowerPoint, Excel, PDF, TXT, Markdown or HTML), each up to 20 MB.
Yes, with edit_document: only what you ask for changes, and new cells use real formulas. An edit costs €0.30 at standard.
Doconda stores documents and files in the European Union (Ireland), and its AI also runs in the EU.
For the full setup, also with @google/genai, see Google Vertex AI.