Language

Create spreadsheets & documents with PHP

Create a shareable spreadsheet from PHP in one request using the built-in cURL extension — no PhpSpreadsheet, no Google client library, no OAuth. POST your rows as JSON and get back a URL you can store or email. The example works in plain PHP, Laravel, and WordPress.

PHP (cURL)
<?php
$ch = curl_init("https://openofficeai.com/api/v1/sheets");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer YOUR_API_KEY",
    "Content-Type: application/json",
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    "title" => "Q3 Revenue",
    "sheets" => [[
        "rows" => [
            ["Month", "Revenue", "Growth"],
            ["July", 48200, "+12%"],
        ],
    ]],
]));

$data = json_decode(curl_exec($ch), true);
echo $data["url"]; // https://openofficeai.com/s/...

How to create a spreadsheet with PHP

  1. 1Copy your API key from the dashboard.
  2. 2Build the JSON body with json_encode() and POST it to /api/v1/sheets with your Bearer token.
  3. 3Read $data["url"] from the decoded response — your shareable link.
  4. 4In Laravel you can swap cURL for Http::withToken(...)->post(...) for the same result.

Why use OpenOfficeAI with PHP

Frequently asked questions

Do I need PhpSpreadsheet to create Excel files?

No. You send rows as JSON and OpenOfficeAI builds the spreadsheet. To get an .xlsx file, request GET /api/v1/download/{id}?format=xlsx after creating it — no PhpSpreadsheet dependency required.

How do I do this in Laravel?

Use the HTTP client: Http::withToken("YOUR_API_KEY")->post("https://openofficeai.com/api/v1/sheets", ["title" => "...", "sheets" => [["rows" => $rows]]])->json("url").

Can I generate a PDF invoice from PHP?

Yes. Create the spreadsheet or document, then request /api/v1/download/{id}?format=pdf to get the PDF bytes, which you can stream to the browser or attach to an email.

Start creating documents with PHP

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

Related integrations