Create spreadsheets & documents with Cloudflare Workers
Create a shareable spreadsheet from a Cloudflare Worker using the standard fetch — no Node APIs needed. It runs at the edge with near-zero cold start, making it a great place to host a lightweight "generate a document" endpoint or a webhook relay that adds the auth header.
export default {
async fetch(request, env) {
const res = await fetch("https://openofficeai.com/api/v1/sheets", {
method: "POST",
headers: {
"Authorization": `Bearer ${env.OPENOFFICEAI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
title: "Edge report",
sheets: [{ rows: [["Month", "Revenue"], ["July", 48200]] }],
}),
});
const { url } = await res.json();
return new Response(url);
},
};How to create a spreadsheet with Cloudflare Workers
- 1Add your API key as a Worker secret (wrangler secret put OPENOFFICEAI_KEY).
- 2In the fetch handler, POST to /api/v1/sheets with the Bearer header from env.
- 3Read the url from the response.
- 4Return it, or relay incoming webhooks to the API with the header attached.
Why use OpenOfficeAI with Cloudflare Workers
- Edge runtime, near-zero cold start, global by default.
- Ideal webhook relay — add the auth header no-code tools can't.
- Standard fetch, no Node-specific dependencies.
Frequently asked questions
How do I store the API key in a Worker?
Use a Worker secret: run "wrangler secret put OPENOFFICEAI_KEY" and read it from env.OPENOFFICEAI_KEY. Never inline the key in the Worker source.
Can I use this as a webhook relay?
Yes. Point a no-code tool's webhook at your Worker; the Worker adds the Authorization header and forwards the body to OpenOfficeAI — solving the "can't set custom headers" limitation.
Does it work the same on Vercel/Deno edge?
Yes. The fetch-based code is portable to Vercel Edge Functions and Deno Deploy with minor handler-signature changes.
Start creating documents with Cloudflare Workers
Free tier includes 500 API calls per month — no card required.
Related integrations