Create spreadsheets & documents with OpenAI Assistants
Give an OpenAI Assistant a function tool so it can create shareable spreadsheets during a run. When the run requires action, you execute the API call and submit the URL back as the tool output, and the Assistant shares the link with the user.
from openai import OpenAI
client = OpenAI()
assistant = client.beta.assistants.create(
model="gpt-4o",
tools=[{"type": "function", "function": {
"name": "create_spreadsheet",
"description": "Create a shareable spreadsheet; returns a URL.",
"parameters": {"type": "object", "properties": {
"title": {"type": "string"},
"rows": {"type": "array", "items": {"type": "array"}}},
"required": ["title", "rows"]}}}],
)
# On requires_action, run the call and submit_tool_outputs with the url.How to create a spreadsheet with OpenAI Assistants
- 1Create an Assistant with a create_spreadsheet function tool.
- 2Start a run; watch for status requires_action.
- 3Execute the matching POST to /api/v1/sheets.
- 4submit_tool_outputs with the url so the Assistant can share it.
Why use OpenOfficeAI with OpenAI Assistants
- Persistent threads — the Assistant remembers prior documents.
- Standard function-tool pattern, easy to add to existing assistants.
- Return a link the Assistant presents in chat.
Frequently asked questions
How is this different from plain function calling?
The Assistants API manages threads and run state for you. You handle the requires_action step by running the function and calling submit_tool_outputs, rather than managing the message loop yourself.
Where does my API key go?
Your code executes the tool, so keep the OpenOfficeAI key in an environment variable on your server. The Assistant only proposes the call.
Can the Assistant make documents too?
Yes. Add a second function tool that posts to /api/v1/docs, and the Assistant can produce reports and memos as shareable docs.
Start creating documents with OpenAI Assistants
Free tier includes 500 API calls per month — no card required.
Related integrations