Create spreadsheets & documents with WordPress
From a WordPress plugin, theme, or a snippet, use wp_remote_post to create shareable spreadsheets — for example, turning WooCommerce orders or form submissions into a live export link. No spreadsheet library needed; WordPress's HTTP API does the call.
$response = wp_remote_post(
'https://openofficeai.com/api/v1/sheets',
array(
'headers' => array(
'Authorization' => 'Bearer YOUR_API_KEY',
'Content-Type' => 'application/json',
),
'body' => wp_json_encode(array(
'title' => 'New order',
'sheets' => array(array('rows' => array(
array('Product', 'Qty', 'Total'),
array('Pro Plan', 1, '$12.00'),
))),
)),
)
);
$data = json_decode(wp_remote_retrieve_body($response), true);
echo esc_url($data['url']);How to create a spreadsheet with WordPress
- 1Add your API key (use wp-config.php constant or an options field, not hardcoded).
- 2Call wp_remote_post with the headers and a wp_json_encode body.
- 3Decode the response with wp_remote_retrieve_body and read url.
- 4Hook it to an action like woocommerce_order_status_completed.
Why use OpenOfficeAI with WordPress
- Uses WordPress's built-in HTTP API — no extra library.
- Turn WooCommerce orders or Contact Form 7 entries into exports.
- Hand customers a clean, shareable link or PDF.
Frequently asked questions
Where should I store the API key in WordPress?
Define it as a constant in wp-config.php (define('OPENOFFICEAI_KEY', '...')) or store it in the options table via a settings page — never hardcode it in a public theme file.
Can I trigger this on a WooCommerce order?
Yes. Hook into an action like woocommerce_order_status_completed, build rows from the order items, and POST them to generate a shareable order sheet.
How do I let users download a PDF?
After creating the document, link them to /api/v1/download/{id}?format=pdf, or fetch it server-side and stream it with the correct headers.
Start creating documents with WordPress
Free tier includes 500 API calls per month — no card required.