Create Excel spreadsheet (.xlsx)

$0.003 per callUSDC via x402POST /api/xlsx-create

Turn rows of data into a real Excel workbook (.xlsx) in one call. Send POST /api/xlsx-create with no required fields (3 optional) and pay $0.003 per call over x402 or MPP (there is no free tier). It returns a JSON object with xlsxBase64, bytes, contentType, filename and sheets.

Send "sheets": each a "name" plus "rows" as an array of arrays or an array of objects (an optional "columns" list sets the order). The first row is a bold, filled, frozen header by default; "headerStyle", "columnWidths" (auto-sized otherwise) and "numberFormats" (such as "#,##0.00") are optional. Every cell is written as a literal value, never a formula: text that starts with = + - or @ stays text. Up to 20 sheets, 10,000 rows per sheet, 200 columns and 50,000 cells, 100,000 characters in all. The request body may be up to 2 MB. Returns the file as base64 with its size, content type and filename.

Category: Data conversionTags: excel xlsx spreadsheet create-excel workbook office export json-to-xlsx

Try in playground →

Parameters

NameTypeRequiredDescription
sheetsarray of objectno1 to 20 sheets: {"name","rows","columns"?,"header"?,"headerStyle"?,"columnWidths"?,"numberFormats"?}. rows: arrays of cells, or objects (keys become the header row). header (default true) styles and freezes the first row. headerStyle: {"bold"?,"fill"?:"#D9E1F2","color"?,"freeze"?}. columnWidths and numberFormats: an array by column, or an object keyed by column key, header text or letter.
rowsarraynoShorthand for one sheet: the rows, with "name", "columns" and the other sheet options at the top level.
filenamestringnoFile name for the answer (default "workbook.xlsx")

Example request

curl -i -X POST https://agent402.tools/api/xlsx-create \
  -H "Content-Type: application/json" \
  -d '{"sheets":[{"name":"Sales","rows":[{"region":"North","units":1200,"revenue":18450.5},{"region":"South","units":860,"revenue":12990},{"region":"West","units":540,"revenue":8120.25}],"columns":["region","units","revenue"],"numberFormats":{"revenue":"#,##0.00"}}],"filename":"sales.xlsx"}'

Without payment this returns HTTP 402 Payment Required with the exact price for xlsx-create; any x402 v2 or MPP client pays it and retries.

Example response

{
  "xlsxBase64": "UEsDBBQACAAIAG...",
  "bytes": 3191,
  "contentType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
  "filename": "sales.xlsx",
  "sheets": [
    {
      "name": "Sales",
      "rows": 4,
      "columns": 3
    }
  ]
}
FieldTypeAlways presentIn the example
xlsxBase64stringyesUEsDBBQACAAIAG...
bytesnumberyes3191
contentTypestringyesapplication/vnd.openxmlformats-officedocument.spreadsheetml.sheet
filenamestringyessales.xlsx
sheetsarray of objectsyes1 item in the example

From an MCP client

catalog.call {
  "slug": "xlsx-create",
  "params": {
    "sheets": [
      {
        "name": "Sales",
        "rows": [
          {
            "region": "North",
            "units": 1200,
            "revenue": 18450.5
          },
          {
            "region": "South",
            "units": 860,
            "revenue": 12990
          },
          {
            "region": "West",
            "units": 540,
            "revenue": 8120.25
          }
        ],
        "columns": [
          "region",
          "units",
          "revenue"
        ],
        "numberFormats": {
          "revenue": "#,##0.00"
        }
      }
    ],
    "filename": "sales.xlsx"
  }
}

The hosted connector at https://agent402.tools/mcp needs a payment for xlsx-create; the stdio package pays it from a wallet or from an AGENT402_CREDITS_KEY issued earlier. Local install: npx -y [email protected].

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.003" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/xlsx-create", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "sheets": [
      {
        "name": "Sales",
        "rows": [
          {
            "region": "North",
            "units": 1200,
            "revenue": 18450.5
          },
          {
            "region": "South",
            "units": 860,
            "revenue": 12990
          },
          {
            "region": "West",
            "units": 540,
            "revenue": 8120.25
          }
        ],
        "columns": [
          "region",
          "units",
          "revenue"
        ],
        "numberFormats": {
          "revenue": "#,##0.00"
        }
      }
    ],
    "filename": "sales.xlsx"
  }),
});

Related tools

Create Word document (.docx)

$0.003 · POST /api/docx-create

Turn markdown into a real Word document (.docx) in one call.

Create PowerPoint deck (.pptx)

$0.003 · POST /api/pptx-create

Turn slide outlines into a real PowerPoint deck (.pptx, 16:9) in one call.

JSON to CSV

FREE w/ compute · or $0.002 · POST /api/json-to-csv

Convert a JSON array of objects to CSV.

Base / radix convert

FREE w/ compute · or $0.001 · POST /api/base-convert

Convert an integer between number bases (radix 2-36), e.g. binary↔hex↔decimal.

CSV to JSON

FREE w/ compute · or $0.002 · POST /api/csv-to-json

Parse CSV (quoted fields supported) into a JSON array of objects, using the first row as headers (header=false.

CSV to Markdown table

FREE w/ compute · or $0.002 · POST /api/csv-to-md

Convert CSV into a GitHub-flavored Markdown table (first row is the header).