Create spreadsheets & documents with AutoGen
Register a function with a Microsoft AutoGen agent so it can produce shareable spreadsheets instead of plain text. The assistant proposes the call and the executor runs it, returning a link. Works with AutoGen's register_function pattern.
import requests
from autogen import register_function
def create_spreadsheet(title: str, rows: list) -> str:
"""Create a shareable spreadsheet (first row = header). Returns a URL."""
r = requests.post(
"https://openofficeai.com/api/v1/sheets",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"title": title, "sheets": [{"rows": rows}]},
)
return r.json()["url"]
register_function(
create_spreadsheet,
caller=assistant, # the agent that proposes the call
executor=user_proxy, # the agent that runs it
description="Create a shareable spreadsheet and return its URL.",
)How to create a spreadsheet with AutoGen
- 1Define a create_spreadsheet function that POSTs to /api/v1/sheets.
- 2register_function with the caller (assistant) and executor (user proxy).
- 3Give it a clear description so the model knows when to use it.
- 4The agent now hands back shareable links from the conversation.
Why use OpenOfficeAI with AutoGen
- Fits AutoGen's caller/executor function pattern.
- Agents output artifacts, not walls of text.
- Simple JSON signature keeps tool calls reliable.
Frequently asked questions
Which agent runs the function?
The executor you pass to register_function (typically a UserProxyAgent) actually runs the Python; the caller (assistant) only proposes the call. Keep your API key in the executor's environment.
Can a group chat use this tool?
Yes. Register the function with the relevant agents in your GroupChat, and the manager will route to the agent that can create spreadsheets when appropriate.
Can it build documents too?
Yes. Add a second function that posts to /api/v1/docs with a content array, and the agent can produce written reports as shareable docs.
Start creating documents with AutoGen
Free tier includes 500 API calls per month — no card required.
Related integrations