Skip to main content
POST
/
v1
/
excel
/
jobs
Create Spreadsheet
curl --request POST \
  --url https://api.stru.ai/v1/excel/jobs \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "operation": "<string>",
  "workbook_name": "<string>",
  "sheets": [
    {}
  ]
}'

Overview

Create a complete Excel workbook by defining logical content blocks. The intelligent layout engine automatically handles cell positioning and formula references, freeing you from managing specific cell addresses.
Asynchronous Operation: Returns immediately with a job ID. Poll for the download URL.

Authentication

Authorization
string
required
Bearer token (API key from app.stru.ai)

Request Body

operation
string
required
Must be "create_spreadsheet"
workbook_name
string
required
Workbook name/title
sheets
array
required
Array of sheet definitionsSee Sheet Structure below

Sheet Structure

Each sheet contains an array of content blocks:
{
  "name": "Summary",
  "blocks": [
    {"type": "header", "content": "Project Summary"},
    {"type": "data_table", "headers": [...], "rows": [...]},
    {"type": "formula", "label": "Total", "expression": "=SUM(...)"}
  ]
}

Example Request

curl -X POST https://api.stru.ai/v1/excel/jobs \
  -H "Authorization: Bearer sk_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "create_spreadsheet",
    "workbook_name": "Cost Summary",
    "sheets": [
      {
        "name": "Materials",
        "blocks": [
          {
            "type": "header",
            "content": "Material Costs"
          },
          {
            "type": "data_table",
            "name": "COSTS",
            "headers": ["Item", "Qty", "Price", "Total"],
            "rows": [
              ["Concrete", 100, 150, "=B2*C2"],
              ["Steel", 50, 2000, "=B3*C3"]
            ]
          },
          {
            "type": "formula",
            "label": "Grand Total",
            "expression": "=SUM(COSTS[Total])",
            "format": "currency"
          }
        ]
      }
    ]
  }'

Response

When complete:
{
  "job_id": "job_xls_abc123",
  "status": "completed",
  "results": {
    "file_url": "https://storage.stru.ai/temp/summary.xlsx?signature=...",
    "file_type": "xlsx",
    "expires_at": "2025-10-18T10:30:00Z"
  }
}
Excel generation typically takes 3-10 seconds depending on complexity.

Best Practices

Name your tables - Use the name field for data tables to reference them in formulas
Use structured references - Reference named tables in formulas: =SUM(MATERIALS[Total])
Let the API handle layout - Don’t specify cell positions; the intelligent engine optimizes placement

Next Steps

After creating the job, poll Get Job Status to retrieve the download URL.