Create spreadsheets & documents with Elixir
Create a shareable spreadsheet from Elixir using Req (or HTTPoison) — no Google setup. POST a map as JSON and read the URL. Fits Phoenix controllers, Oban background jobs, and GenServers that emit reports.
Elixir (Req)
{:ok, res} =
Req.post("https://openofficeai.com/api/v1/sheets",
headers: [{"authorization", "Bearer YOUR_API_KEY"}],
json: %{
title: "Q3 Revenue",
sheets: [%{rows: [
["Month", "Revenue", "Growth"],
["July", 48200, "+12%"]
]}]
}
)
IO.puts(res.body["url"])How to create a spreadsheet with Elixir
- 1Add :req to your deps.
- 2Call Req.post/2 with the json: option and an Authorization header.
- 3Read res.body["url"] from the decoded response.
- 4Run it inside an Oban worker to keep it off the request path.
Why use OpenOfficeAI with Elixir
- Req decodes JSON automatically — minimal code.
- Great for Phoenix apps and Oban background jobs.
- Turn Ecto query results into a shareable sheet.
Frequently asked questions
Can I use HTTPoison or Finch instead of Req?
Yes. Any HTTP client works — encode the body with Jason.encode!/1, set the Authorization and Content-Type headers, and POST to the same endpoint. Req just bundles JSON handling for you.
How do I do this in a Phoenix LiveView?
Call the API from an async Task (or an Oban job) so you don't block the LiveView process, then push the returned url to the socket assigns to render the link.
How do I export to PDF from Elixir?
After creating the document, GET /api/v1/download/{id}?format=pdf and send the binary with Plug's send_download/3 or store it.
Start creating documents with Elixir
Free tier includes 500 API calls per month — no card required.