Integrations/Supabase
Language

Create spreadsheets & documents with Supabase

From a Supabase Edge Function (Deno) you can create a shareable spreadsheet whenever your data changes — for example, generating a report when a row is inserted. Pair it with a Database Webhook so a table change triggers the function and produces a live document link.

Supabase Edge Function (Deno)
Deno.serve(async (req) => {
  const { record } = await req.json(); // from the DB webhook

  const res = await fetch("https://openofficeai.com/api/v1/sheets", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${Deno.env.get("OPENOFFICEAI_KEY")}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      title: `Order ${record.id}`,
      sheets: [{ rows: [["Field", "Value"], ["Total", record.total]] }],
    }),
  });

  return new Response(JSON.stringify(await res.json()));
});

How to create a spreadsheet with Supabase

  1. 1Set the key as a secret: supabase secrets set OPENOFFICEAI_KEY=...
  2. 2Write an Edge Function that POSTs to /api/v1/sheets.
  3. 3Create a Database Webhook that calls the function on insert/update.
  4. 4Store the returned url back in your table if you want a permanent link.

Why use OpenOfficeAI with Supabase

Frequently asked questions

How do I trigger this on a row change?

Create a Database Webhook (or a trigger calling pg_net) that POSTs the changed record to your Edge Function URL, which then builds the spreadsheet and returns the link.

Where do I keep the API key?

Use Supabase function secrets: "supabase secrets set OPENOFFICEAI_KEY=..." and read it with Deno.env.get. It stays out of your function code and repo.

Can I save the link back to the database?

Yes. Use the Supabase client inside the function to update the originating row with the returned url, so the shareable link lives alongside your data.

Start creating documents with Supabase

Free tier includes 500 API calls per month — no card required.