Generate XLSX Files from JSON with an API

6 min read Sheet Generation

XLSX Libraries Are Verbose

You need to generate an Excel file from application data. Maybe it’s a monthly report, an invoice, or a data export a client asked for. So you reach for an XLSX library.

In JavaScript, that’s ExcelJS or SheetJS. You create a workbook, add a worksheet, set column widths, iterate over rows, apply number formats using Excel format strings, set font properties on individual cells, and handle the binary output. What should be “turn this JSON into a spreadsheet” becomes 50+ lines of imperative cell manipulation.

And that’s before you need currency formatting that works across locales, or formulas that reference ranges, or merged cells for section headers. Each one adds another layer of library-specific API surface you need to learn and maintain.

A Better Approach: Describe the Spreadsheet, Get the File

The Sheet Generation API takes a JSON description of your spreadsheet and returns a formatted XLSX file. You describe what the spreadsheet should look like — columns, rows, formats, styles — and the API handles the binary format details.

Let’s build one up step by step.

Step 1: A Basic Spreadsheet

Start with the minimum: columns and rows of plain text.

Request
curl -X POST https://api.iterationlayer.com/sheet-generation/v1/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "xlsx",
    "sheets": [
      {
        "name": "Employees",
        "columns": [
          {
            "name": "Name"
          },
          {
            "name": "Department"
          },
          {
            "name": "Start Date"
          }
        ],
        "rows": [
          [
            {
              "value": "Alice Chen"
            },
            {
              "value": "Engineering"
            },
            {
              "value": "2024-01-15"
            }
          ],
          [
            {
              "value": "Bob Martinez"
            },
            {
              "value": "Design"
            },
            {
              "value": "2024-03-01"
            }
          ],
          [
            {
              "value": "Carol Tanaka"
            },
            {
              "value": "Engineering"
            },
            {
              "value": "2024-06-10"
            }
          ]
        ]
      }
    ]
  }'
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({
  apiKey: "YOUR_API_KEY",
});

const result = await client.generateSheet({
  format: "xlsx",
  sheets: [
    {
      name: "Employees",
      columns: [
        {
          name: "Name",
        },
        {
          name: "Department",
        },
        {
          name: "Start Date",
        },
      ],
      rows: [
        [
          {
            value: "Alice Chen",
          },
          {
            value: "Engineering",
          },
          {
            value: "2024-01-15",
          },
        ],
        [
          {
            value: "Bob Martinez",
          },
          {
            value: "Design",
          },
          {
            value: "2024-03-01",
          },
        ],
        [
          {
            value: "Carol Tanaka",
          },
          {
            value: "Engineering",
          },
          {
            value: "2024-06-10",
          },
        ],
      ],
    },
  ],
});
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.generate_sheet(
    format="xlsx",
    sheets=[
        {
            "name": "Employees",
            "columns": [
                {
                    "name": "Name",
                },
                {
                    "name": "Department",
                },
                {
                    "name": "Start Date",
                },
            ],
            "rows": [
                [
                    {
                        "value": "Alice Chen",
                    },
                    {
                        "value": "Engineering",
                    },
                    {
                        "value": "2024-01-15",
                    },
                ],
                [
                    {
                        "value": "Bob Martinez",
                    },
                    {
                        "value": "Design",
                    },
                    {
                        "value": "2024-03-01",
                    },
                ],
                [
                    {
                        "value": "Carol Tanaka",
                    },
                    {
                        "value": "Engineering",
                    },
                    {
                        "value": "2024-06-10",
                    },
                ],
            ],
        },
    ],
)
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
package main

import il "github.com/iterationlayer/sdk-go"

func main() {
    client := il.NewClient("YOUR_API_KEY")

    result, err := client.GenerateSheet(il.GenerateSheetRequest{
        Format: "xlsx",
        Sheets: []il.Sheet{
            {
                Name: "Employees",
                Columns: []il.SheetColumn{
                    {
                        Name: "Name",
                    },
                    {
                        Name: "Department",
                    },
                    {
                        Name: "Start Date",
                    },
                },
                Rows: []il.SheetRow{
                    {
                        {
                            Value: "Alice Chen",
                        },
                        {
                            Value: "Engineering",
                        },
                        {
                            Value: "2024-01-15",
                        },
                    },
                    {
                        {
                            Value: "Bob Martinez",
                        },
                        {
                            Value: "Design",
                        },
                        {
                            Value: "2024-03-01",
                        },
                    },
                    {
                        {
                            Value: "Carol Tanaka",
                        },
                        {
                            Value: "Engineering",
                        },
                        {
                            Value: "2024-06-10",
                        },
                    },
                },
            },
        },
    })
    if err != nil {
        panic(err)
    }
    _ = result
}
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}

That’s a working XLSX file. Three columns, three rows, ready to open in Excel. The columns array defines the header row. Each row is an array of cell objects.

Step 2: Add Number Formatting

Real spreadsheets have numbers, and numbers need formatting. Let’s add salary data with currency formatting.

Request
curl -X POST https://api.iterationlayer.com/sheet-generation/v1/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "xlsx",
    "sheets": [
      {
        "name": "Compensation",
        "columns": [
          {
            "name": "Name"
          },
          {
            "name": "Department"
          },
          {
            "name": "Annual Salary"
          },
          {
            "name": "Bonus Rate"
          }
        ],
        "rows": [
          [
            {
              "value": "Alice Chen"
            },
            {
              "value": "Engineering"
            },
            {
              "value": 125000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 0.15,
              "format": "percentage"
            }
          ],
          [
            {
              "value": "Bob Martinez"
            },
            {
              "value": "Design"
            },
            {
              "value": 98000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 0.10,
              "format": "percentage"
            }
          ],
          [
            {
              "value": "Carol Tanaka"
            },
            {
              "value": "Engineering"
            },
            {
              "value": 115000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 0.12,
              "format": "percentage"
            }
          ]
        ]
      }
    ]
  }'
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({
  apiKey: "YOUR_API_KEY",
});

const result = await client.generateSheet({
  format: "xlsx",
  sheets: [
    {
      name: "Compensation",
      columns: [
        {
          name: "Name",
        },
        {
          name: "Department",
        },
        {
          name: "Annual Salary",
        },
        {
          name: "Bonus Rate",
        },
      ],
      rows: [
        [
          {
            value: "Alice Chen",
          },
          {
            value: "Engineering",
          },
          {
            value: 125_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 0.15,
            format: "percentage",
          },
        ],
        [
          {
            value: "Bob Martinez",
          },
          {
            value: "Design",
          },
          {
            value: 98_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 0.10,
            format: "percentage",
          },
        ],
        [
          {
            value: "Carol Tanaka",
          },
          {
            value: "Engineering",
          },
          {
            value: 115_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 0.12,
            format: "percentage",
          },
        ],
      ],
    },
  ],
});
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.generate_sheet(
    format="xlsx",
    sheets=[
        {
            "name": "Compensation",
            "columns": [
                {
                    "name": "Name",
                },
                {
                    "name": "Department",
                },
                {
                    "name": "Annual Salary",
                },
                {
                    "name": "Bonus Rate",
                },
            ],
            "rows": [
                [
                    {
                        "value": "Alice Chen",
                    },
                    {
                        "value": "Engineering",
                    },
                    {
                        "value": 125000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 0.15,
                        "format": "percentage",
                    },
                ],
                [
                    {
                        "value": "Bob Martinez",
                    },
                    {
                        "value": "Design",
                    },
                    {
                        "value": 98000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 0.10,
                        "format": "percentage",
                    },
                ],
                [
                    {
                        "value": "Carol Tanaka",
                    },
                    {
                        "value": "Engineering",
                    },
                    {
                        "value": 115000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 0.12,
                        "format": "percentage",
                    },
                ],
            ],
        },
    ],
)
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
package main

import il "github.com/iterationlayer/sdk-go"

func main() {
    client := il.NewClient("YOUR_API_KEY")

    result, err := client.GenerateSheet(il.GenerateSheetRequest{
        Format: "xlsx",
        Sheets: []il.Sheet{
            {
                Name: "Compensation",
                Columns: []il.SheetColumn{
                    {
                        Name: "Name",
                    },
                    {
                        Name: "Department",
                    },
                    {
                        Name: "Annual Salary",
                    },
                    {
                        Name: "Bonus Rate",
                    },
                },
                Rows: []il.SheetRow{
                    {
                        {
                            Value: "Alice Chen",
                        },
                        {
                            Value: "Engineering",
                        },
                        {
                            Value:        125000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:  0.15,
                            Format: "percentage",
                        },
                    },
                    {
                        {
                            Value: "Bob Martinez",
                        },
                        {
                            Value: "Design",
                        },
                        {
                            Value:        98000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:  0.10,
                            Format: "percentage",
                        },
                    },
                    {
                        {
                            Value: "Carol Tanaka",
                        },
                        {
                            Value: "Engineering",
                        },
                        {
                            Value:        115000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:  0.12,
                            Format: "percentage",
                        },
                    },
                },
            },
        },
    })
    if err != nil {
        panic(err)
    }
    _ = result
}
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}

The format: "currency" field tells the API to render the value with the correct symbol and decimal places. USD gets $125,000.00. EUR would get the euro symbol. The API supports 162 ISO 4217 currency codes.

The format: "percentage" field multiplies by 100 and adds a percent sign. The value 0.15 renders as 15.00%.

For European-style number formatting, add a number_style:

{
  value: 125_000,
  format: "currency",
  currency_code: "EUR",
  number_style: "period_comma",
}
// Renders as: €125.000,00

Step 3: Apply Styles

A plain spreadsheet works, but styled headers and readable fonts make the difference between “data dump” and “professional report.”

Request
curl -X POST https://api.iterationlayer.com/sheet-generation/v1/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "xlsx",
    "styles": {
      "header": {
        "is_bold": true,
        "font_size_in_pt": 11,
        "font_color": "#ffffff",
        "background_color": "#2d3748",
        "horizontal_alignment": "center"
      },
      "body": {
        "font_size_in_pt": 10
      }
    },
    "sheets": [
      {
        "name": "Compensation",
        "columns": [
          {
            "name": "Name",
            "width": 25
          },
          {
            "name": "Department",
            "width": 20
          },
          {
            "name": "Annual Salary",
            "width": 18
          },
          {
            "name": "Bonus Rate",
            "width": 15
          }
        ],
        "rows": [
          [
            {
              "value": "Alice Chen"
            },
            {
              "value": "Engineering"
            },
            {
              "value": 125000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 0.15,
              "format": "percentage"
            }
          ],
          [
            {
              "value": "Bob Martinez"
            },
            {
              "value": "Design"
            },
            {
              "value": 98000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 0.10,
              "format": "percentage"
            }
          ],
          [
            {
              "value": "Carol Tanaka"
            },
            {
              "value": "Engineering"
            },
            {
              "value": 115000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 0.12,
              "format": "percentage"
            }
          ]
        ]
      }
    ]
  }'
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({
  apiKey: "YOUR_API_KEY",
});

const result = await client.generateSheet({
  format: "xlsx",
  styles: {
    header: {
      is_bold: true,
      font_size_in_pt: 11,
      font_color: "#ffffff",
      background_color: "#2d3748",
      horizontal_alignment: "center",
    },
    body: {
      font_size_in_pt: 10,
    },
  },
  sheets: [
    {
      name: "Compensation",
      columns: [
        {
          name: "Name",
          width: 25,
        },
        {
          name: "Department",
          width: 20,
        },
        {
          name: "Annual Salary",
          width: 18,
        },
        {
          name: "Bonus Rate",
          width: 15,
        },
      ],
      rows: [
        [
          {
            value: "Alice Chen",
          },
          {
            value: "Engineering",
          },
          {
            value: 125_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 0.15,
            format: "percentage",
          },
        ],
        [
          {
            value: "Bob Martinez",
          },
          {
            value: "Design",
          },
          {
            value: 98_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 0.10,
            format: "percentage",
          },
        ],
        [
          {
            value: "Carol Tanaka",
          },
          {
            value: "Engineering",
          },
          {
            value: 115_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 0.12,
            format: "percentage",
          },
        ],
      ],
    },
  ],
});
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.generate_sheet(
    format="xlsx",
    styles={
        "header": {
            "is_bold": True,
            "font_size_in_pt": 11,
            "font_color": "#ffffff",
            "background_color": "#2d3748",
            "horizontal_alignment": "center",
        },
        "body": {
            "font_size_in_pt": 10,
        },
    },
    sheets=[
        {
            "name": "Compensation",
            "columns": [
                {
                    "name": "Name",
                    "width": 25,
                },
                {
                    "name": "Department",
                    "width": 20,
                },
                {
                    "name": "Annual Salary",
                    "width": 18,
                },
                {
                    "name": "Bonus Rate",
                    "width": 15,
                },
            ],
            "rows": [
                [
                    {
                        "value": "Alice Chen",
                    },
                    {
                        "value": "Engineering",
                    },
                    {
                        "value": 125000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 0.15,
                        "format": "percentage",
                    },
                ],
                [
                    {
                        "value": "Bob Martinez",
                    },
                    {
                        "value": "Design",
                    },
                    {
                        "value": 98000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 0.10,
                        "format": "percentage",
                    },
                ],
                [
                    {
                        "value": "Carol Tanaka",
                    },
                    {
                        "value": "Engineering",
                    },
                    {
                        "value": 115000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 0.12,
                        "format": "percentage",
                    },
                ],
            ],
        },
    ],
)
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
package main

import il "github.com/iterationlayer/sdk-go"

func main() {
    client := il.NewClient("YOUR_API_KEY")

    result, err := client.GenerateSheet(il.GenerateSheetRequest{
        Format: "xlsx",
        Styles: &il.SheetStyles{
            Header: &il.CellStyle{
                IsBold:              true,
                FontSizeInPt:        11,
                FontColor:           "#ffffff",
                BackgroundColor:     "#2d3748",
                HorizontalAlignment: "center",
            },
            Body: &il.CellStyle{
                FontSizeInPt: 10,
            },
        },
        Sheets: []il.Sheet{
            {
                Name: "Compensation",
                Columns: []il.SheetColumn{
                    {
                        Name:  "Name",
                        Width: 25,
                    },
                    {
                        Name:  "Department",
                        Width: 20,
                    },
                    {
                        Name:  "Annual Salary",
                        Width: 18,
                    },
                    {
                        Name:  "Bonus Rate",
                        Width: 15,
                    },
                },
                Rows: []il.SheetRow{
                    {
                        {
                            Value: "Alice Chen",
                        },
                        {
                            Value: "Engineering",
                        },
                        {
                            Value:        125000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:  0.15,
                            Format: "percentage",
                        },
                    },
                    {
                        {
                            Value: "Bob Martinez",
                        },
                        {
                            Value: "Design",
                        },
                        {
                            Value:        98000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:  0.10,
                            Format: "percentage",
                        },
                    },
                    {
                        {
                            Value: "Carol Tanaka",
                        },
                        {
                            Value: "Engineering",
                        },
                        {
                            Value:        115000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:  0.12,
                            Format: "percentage",
                        },
                    },
                },
            },
        },
    })
    if err != nil {
        panic(err)
    }
    _ = result
}
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}

The styles.header object applies to the header row. The styles.body object applies to every data row. Dark header with white text, readable font sizes, and column widths that fit the content.

You can override any style on a specific cell. Need to highlight a value in red? Add a styles field to that cell:

{
  value: 98_000,
  format: "currency",
  currency_code: "USD",
  styles: {
    font_color: "#cc0000",
    is_bold: true,
  },
}

The per-cell style merges with the body style. Only the properties you specify get overridden.

Step 4: Add Formulas

Spreadsheets should compute things. The API supports formula cells — values that start with = are treated as native Excel formulas.

Request
curl -X POST https://api.iterationlayer.com/sheet-generation/v1/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "xlsx",
    "styles": {
      "header": {
        "is_bold": true,
        "background_color": "#2d3748",
        "font_color": "#ffffff"
      }
    },
    "sheets": [
      {
        "name": "Project Budget",
        "columns": [
          {
            "name": "Category",
            "width": 25
          },
          {
            "name": "Q1",
            "width": 15
          },
          {
            "name": "Q2",
            "width": 15
          },
          {
            "name": "Q3",
            "width": 15
          },
          {
            "name": "Q4",
            "width": 15
          },
          {
            "name": "Annual Total",
            "width": 18
          }
        ],
        "rows": [
          [
            {
              "value": "Engineering"
            },
            {
              "value": 45000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 48000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 52000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 50000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": "=SUM(B2:E2)",
              "format": "currency",
              "currency_code": "USD"
            }
          ],
          [
            {
              "value": "Design"
            },
            {
              "value": 22000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 24000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 23000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 25000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": "=SUM(B3:E3)",
              "format": "currency",
              "currency_code": "USD"
            }
          ],
          [
            {
              "value": "Infrastructure"
            },
            {
              "value": 15000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 15000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 18000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 20000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": "=SUM(B4:E4)",
              "format": "currency",
              "currency_code": "USD"
            }
          ],
          [
            {
              "value": "Total",
              "styles": {
                "is_bold": true
              }
            },
            {
              "value": "=SUM(B2:B4)",
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": "=SUM(C2:C4)",
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": "=SUM(D2:D4)",
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": "=SUM(E2:E4)",
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": "=SUM(F2:F4)",
              "format": "currency",
              "currency_code": "USD"
            }
          ]
        ]
      }
    ]
  }'
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({
  apiKey: "YOUR_API_KEY",
});

const result = await client.generateSheet({
  format: "xlsx",
  styles: {
    header: {
      is_bold: true,
      background_color: "#2d3748",
      font_color: "#ffffff",
    },
  },
  sheets: [
    {
      name: "Project Budget",
      columns: [
        {
          name: "Category",
          width: 25,
        },
        {
          name: "Q1",
          width: 15,
        },
        {
          name: "Q2",
          width: 15,
        },
        {
          name: "Q3",
          width: 15,
        },
        {
          name: "Q4",
          width: 15,
        },
        {
          name: "Annual Total",
          width: 18,
        },
      ],
      rows: [
        [
          {
            value: "Engineering",
          },
          {
            value: 45_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 48_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 52_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 50_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: "=SUM(B2:E2)",
            format: "currency",
            currency_code: "USD",
          },
        ],
        [
          {
            value: "Design",
          },
          {
            value: 22_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 24_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 23_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 25_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: "=SUM(B3:E3)",
            format: "currency",
            currency_code: "USD",
          },
        ],
        [
          {
            value: "Infrastructure",
          },
          {
            value: 15_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 15_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 18_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 20_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: "=SUM(B4:E4)",
            format: "currency",
            currency_code: "USD",
          },
        ],
        [
          {
            value: "Total",
            styles: {
              is_bold: true,
            },
          },
          {
            value: "=SUM(B2:B4)",
            format: "currency",
            currency_code: "USD",
          },
          {
            value: "=SUM(C2:C4)",
            format: "currency",
            currency_code: "USD",
          },
          {
            value: "=SUM(D2:D4)",
            format: "currency",
            currency_code: "USD",
          },
          {
            value: "=SUM(E2:E4)",
            format: "currency",
            currency_code: "USD",
          },
          {
            value: "=SUM(F2:F4)",
            format: "currency",
            currency_code: "USD",
          },
        ],
      ],
    },
  ],
});
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.generate_sheet(
    format="xlsx",
    styles={
        "header": {
            "is_bold": True,
            "background_color": "#2d3748",
            "font_color": "#ffffff",
        },
    },
    sheets=[
        {
            "name": "Project Budget",
            "columns": [
                {
                    "name": "Category",
                    "width": 25,
                },
                {
                    "name": "Q1",
                    "width": 15,
                },
                {
                    "name": "Q2",
                    "width": 15,
                },
                {
                    "name": "Q3",
                    "width": 15,
                },
                {
                    "name": "Q4",
                    "width": 15,
                },
                {
                    "name": "Annual Total",
                    "width": 18,
                },
            ],
            "rows": [
                [
                    {
                        "value": "Engineering",
                    },
                    {
                        "value": 45000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 48000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 52000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 50000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": "=SUM(B2:E2)",
                        "format": "currency",
                        "currency_code": "USD",
                    },
                ],
                [
                    {
                        "value": "Design",
                    },
                    {
                        "value": 22000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 24000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 23000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 25000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": "=SUM(B3:E3)",
                        "format": "currency",
                        "currency_code": "USD",
                    },
                ],
                [
                    {
                        "value": "Infrastructure",
                    },
                    {
                        "value": 15000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 15000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 18000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 20000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": "=SUM(B4:E4)",
                        "format": "currency",
                        "currency_code": "USD",
                    },
                ],
                [
                    {
                        "value": "Total",
                        "styles": {
                            "is_bold": True,
                        },
                    },
                    {
                        "value": "=SUM(B2:B4)",
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": "=SUM(C2:C4)",
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": "=SUM(D2:D4)",
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": "=SUM(E2:E4)",
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": "=SUM(F2:F4)",
                        "format": "currency",
                        "currency_code": "USD",
                    },
                ],
            ],
        },
    ],
)
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
package main

import il "github.com/iterationlayer/sdk-go"

func main() {
    client := il.NewClient("YOUR_API_KEY")

    result, err := client.GenerateSheet(il.GenerateSheetRequest{
        Format: "xlsx",
        Styles: &il.SheetStyles{
            Header: &il.CellStyle{
                IsBold:          true,
                BackgroundColor: "#2d3748",
                FontColor:       "#ffffff",
            },
        },
        Sheets: []il.Sheet{
            {
                Name: "Project Budget",
                Columns: []il.SheetColumn{
                    {
                        Name:  "Category",
                        Width: 25,
                    },
                    {
                        Name:  "Q1",
                        Width: 15,
                    },
                    {
                        Name:  "Q2",
                        Width: 15,
                    },
                    {
                        Name:  "Q3",
                        Width: 15,
                    },
                    {
                        Name:  "Q4",
                        Width: 15,
                    },
                    {
                        Name:  "Annual Total",
                        Width: 18,
                    },
                },
                Rows: []il.SheetRow{
                    {
                        {
                            Value: "Engineering",
                        },
                        {
                            Value:        45000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        48000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        52000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        50000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        "=SUM(B2:E2)",
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                    },
                    {
                        {
                            Value: "Design",
                        },
                        {
                            Value:        22000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        24000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        23000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        25000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        "=SUM(B3:E3)",
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                    },
                    {
                        {
                            Value: "Infrastructure",
                        },
                        {
                            Value:        15000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        15000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        18000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        20000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        "=SUM(B4:E4)",
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                    },
                    {
                        {
                            Value: "Total",
                            Styles: &il.CellStyle{
                                IsBold: true,
                            },
                        },
                        {
                            Value:        "=SUM(B2:B4)",
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        "=SUM(C2:C4)",
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        "=SUM(D2:D4)",
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        "=SUM(E2:E4)",
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        "=SUM(F2:F4)",
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                    },
                },
            },
        },
    })
    if err != nil {
        panic(err)
    }
    _ = result
}
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}

When Excel opens this file, every formula evaluates natively. The “Annual Total” column sums each row. The “Total” row sums each column. The bottom-right cell gives you the grand total.

If you request CSV or Markdown format with the same payload, the API evaluates the formulas server-side and writes the computed values. Same data, same structure, correct output in every format.

The Full Example

Putting it all together — styled headers, formatted numbers, formulas, column widths — here’s a complete request you can copy and run:

Request
curl -X POST https://api.iterationlayer.com/sheet-generation/v1/generate \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "format": "xlsx",
    "styles": {
      "header": {
        "is_bold": true,
        "font_size_in_pt": 11,
        "background_color": "#2d3748",
        "font_color": "#ffffff",
        "horizontal_alignment": "center"
      },
      "body": {
        "font_size_in_pt": 10
      }
    },
    "sheets": [
      {
        "name": "Q1 Summary",
        "columns": [
          {
            "name": "Department",
            "width": 20
          },
          {
            "name": "Headcount",
            "width": 12
          },
          {
            "name": "Budget",
            "width": 16
          },
          {
            "name": "Spent",
            "width": 16
          },
          {
            "name": "Remaining",
            "width": 16
          }
        ],
        "rows": [
          [
            {
              "value": "Engineering"
            },
            {
              "value": 12,
              "format": "number"
            },
            {
              "value": 180000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 145000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": "=C2-D2",
              "format": "currency",
              "currency_code": "USD"
            }
          ],
          [
            {
              "value": "Design"
            },
            {
              "value": 5,
              "format": "number"
            },
            {
              "value": 75000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 68000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": "=C3-D3",
              "format": "currency",
              "currency_code": "USD"
            }
          ],
          [
            {
              "value": "Marketing"
            },
            {
              "value": 8,
              "format": "number"
            },
            {
              "value": 120000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": 95000,
              "format": "currency",
              "currency_code": "USD"
            },
            {
              "value": "=C4-D4",
              "format": "currency",
              "currency_code": "USD"
            }
          ],
          [
            {
              "value": "Total",
              "styles": {
                "is_bold": true
              }
            },
            {
              "value": "=SUM(B2:B4)",
              "format": "number",
              "styles": {
                "is_bold": true
              }
            },
            {
              "value": "=SUM(C2:C4)",
              "format": "currency",
              "currency_code": "USD",
              "styles": {
                "is_bold": true
              }
            },
            {
              "value": "=SUM(D2:D4)",
              "format": "currency",
              "currency_code": "USD",
              "styles": {
                "is_bold": true
              }
            },
            {
              "value": "=SUM(E2:E4)",
              "format": "currency",
              "currency_code": "USD",
              "styles": {
                "is_bold": true
              }
            }
          ]
        ]
      }
    ]
  }'
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({
  apiKey: "YOUR_API_KEY",
});

const result = await client.generateSheet({
  format: "xlsx",
  styles: {
    header: {
      is_bold: true,
      font_size_in_pt: 11,
      background_color: "#2d3748",
      font_color: "#ffffff",
      horizontal_alignment: "center",
    },
    body: {
      font_size_in_pt: 10,
    },
  },
  sheets: [
    {
      name: "Q1 Summary",
      columns: [
        {
          name: "Department",
          width: 20,
        },
        {
          name: "Headcount",
          width: 12,
        },
        {
          name: "Budget",
          width: 16,
        },
        {
          name: "Spent",
          width: 16,
        },
        {
          name: "Remaining",
          width: 16,
        },
      ],
      rows: [
        [
          {
            value: "Engineering",
          },
          {
            value: 12,
            format: "number",
          },
          {
            value: 180_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 145_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: "=C2-D2",
            format: "currency",
            currency_code: "USD",
          },
        ],
        [
          {
            value: "Design",
          },
          {
            value: 5,
            format: "number",
          },
          {
            value: 75_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 68_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: "=C3-D3",
            format: "currency",
            currency_code: "USD",
          },
        ],
        [
          {
            value: "Marketing",
          },
          {
            value: 8,
            format: "number",
          },
          {
            value: 120_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: 95_000,
            format: "currency",
            currency_code: "USD",
          },
          {
            value: "=C4-D4",
            format: "currency",
            currency_code: "USD",
          },
        ],
        [
          {
            value: "Total",
            styles: {
              is_bold: true,
            },
          },
          {
            value: "=SUM(B2:B4)",
            format: "number",
            styles: {
              is_bold: true,
            },
          },
          {
            value: "=SUM(C2:C4)",
            format: "currency",
            currency_code: "USD",
            styles: {
              is_bold: true,
            },
          },
          {
            value: "=SUM(D2:D4)",
            format: "currency",
            currency_code: "USD",
            styles: {
              is_bold: true,
            },
          },
          {
            value: "=SUM(E2:E4)",
            format: "currency",
            currency_code: "USD",
            styles: {
              is_bold: true,
            },
          },
        ],
      ],
    },
  ],
});
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.generate_sheet(
    format="xlsx",
    styles={
        "header": {
            "is_bold": True,
            "font_size_in_pt": 11,
            "background_color": "#2d3748",
            "font_color": "#ffffff",
            "horizontal_alignment": "center",
        },
        "body": {
            "font_size_in_pt": 10,
        },
    },
    sheets=[
        {
            "name": "Q1 Summary",
            "columns": [
                {
                    "name": "Department",
                    "width": 20,
                },
                {
                    "name": "Headcount",
                    "width": 12,
                },
                {
                    "name": "Budget",
                    "width": 16,
                },
                {
                    "name": "Spent",
                    "width": 16,
                },
                {
                    "name": "Remaining",
                    "width": 16,
                },
            ],
            "rows": [
                [
                    {
                        "value": "Engineering",
                    },
                    {
                        "value": 12,
                        "format": "number",
                    },
                    {
                        "value": 180000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 145000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": "=C2-D2",
                        "format": "currency",
                        "currency_code": "USD",
                    },
                ],
                [
                    {
                        "value": "Design",
                    },
                    {
                        "value": 5,
                        "format": "number",
                    },
                    {
                        "value": 75000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 68000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": "=C3-D3",
                        "format": "currency",
                        "currency_code": "USD",
                    },
                ],
                [
                    {
                        "value": "Marketing",
                    },
                    {
                        "value": 8,
                        "format": "number",
                    },
                    {
                        "value": 120000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": 95000,
                        "format": "currency",
                        "currency_code": "USD",
                    },
                    {
                        "value": "=C4-D4",
                        "format": "currency",
                        "currency_code": "USD",
                    },
                ],
                [
                    {
                        "value": "Total",
                        "styles": {
                            "is_bold": True,
                        },
                    },
                    {
                        "value": "=SUM(B2:B4)",
                        "format": "number",
                        "styles": {
                            "is_bold": True,
                        },
                    },
                    {
                        "value": "=SUM(C2:C4)",
                        "format": "currency",
                        "currency_code": "USD",
                        "styles": {
                            "is_bold": True,
                        },
                    },
                    {
                        "value": "=SUM(D2:D4)",
                        "format": "currency",
                        "currency_code": "USD",
                        "styles": {
                            "is_bold": True,
                        },
                    },
                    {
                        "value": "=SUM(E2:E4)",
                        "format": "currency",
                        "currency_code": "USD",
                        "styles": {
                            "is_bold": True,
                        },
                    },
                ],
            ],
        },
    ],
)
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}
Request
package main

import il "github.com/iterationlayer/sdk-go"

func main() {
    client := il.NewClient("YOUR_API_KEY")

    result, err := client.GenerateSheet(il.GenerateSheetRequest{
        Format: "xlsx",
        Styles: &il.SheetStyles{
            Header: &il.CellStyle{
                IsBold:              true,
                FontSizeInPt:        11,
                BackgroundColor:     "#2d3748",
                FontColor:           "#ffffff",
                HorizontalAlignment: "center",
            },
            Body: &il.CellStyle{
                FontSizeInPt: 10,
            },
        },
        Sheets: []il.Sheet{
            {
                Name: "Q1 Summary",
                Columns: []il.SheetColumn{
                    {
                        Name:  "Department",
                        Width: 20,
                    },
                    {
                        Name:  "Headcount",
                        Width: 12,
                    },
                    {
                        Name:  "Budget",
                        Width: 16,
                    },
                    {
                        Name:  "Spent",
                        Width: 16,
                    },
                    {
                        Name:  "Remaining",
                        Width: 16,
                    },
                },
                Rows: []il.SheetRow{
                    {
                        {
                            Value: "Engineering",
                        },
                        {
                            Value:  12,
                            Format: "number",
                        },
                        {
                            Value:        180000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        145000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        "=C2-D2",
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                    },
                    {
                        {
                            Value: "Design",
                        },
                        {
                            Value:  5,
                            Format: "number",
                        },
                        {
                            Value:        75000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        68000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        "=C3-D3",
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                    },
                    {
                        {
                            Value: "Marketing",
                        },
                        {
                            Value:  8,
                            Format: "number",
                        },
                        {
                            Value:        120000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        95000,
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                        {
                            Value:        "=C4-D4",
                            Format:       "currency",
                            CurrencyCode: "USD",
                        },
                    },
                    {
                        {
                            Value: "Total",
                            Styles: &il.CellStyle{
                                IsBold: true,
                            },
                        },
                        {
                            Value:  "=SUM(B2:B4)",
                            Format: "number",
                            Styles: &il.CellStyle{
                                IsBold: true,
                            },
                        },
                        {
                            Value:        "=SUM(C2:C4)",
                            Format:       "currency",
                            CurrencyCode: "USD",
                            Styles: &il.CellStyle{
                                IsBold: true,
                            },
                        },
                        {
                            Value:        "=SUM(D2:D4)",
                            Format:       "currency",
                            CurrencyCode: "USD",
                            Styles: &il.CellStyle{
                                IsBold: true,
                            },
                        },
                        {
                            Value:        "=SUM(E2:E4)",
                            Format:       "currency",
                            CurrencyCode: "USD",
                            Styles: &il.CellStyle{
                                IsBold: true,
                            },
                        },
                    },
                },
            },
        },
    })
    if err != nil {
        panic(err)
    }
    _ = result
}
Response
{
  "success": true,
  "data": {
    "buffer": "UEsDBBQAAAAIAA...",
    "mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
  }
}

Next Steps

The Sheet Generation docs cover the full API reference — all cell formats, style properties, cell merging, custom fonts, and multi-sheet support.

If you’re generating spreadsheets from extracted document data, the Document Extraction to Spreadsheet pipeline walks through the end-to-end workflow.

Start building in minutes

Free trial included. No credit card required.