XLSX

Merge, Columns & Rows

Merged cells, column widths, and row heights

Merged Cells

Merge a range of cells by specifying the top-left and bottom-right corners using row and column indices (1-based):

{
  "worksheets": [
    {
      "name": "Sheet1",
      "mergeCells": [{ "from": { "row": 1, "col": 1 }, "to": { "row": 1, "col": 4 } }],
      "children": [
        { "cells": [{ "value": "Merged header across 4 columns" }] },
        { "cells": [{ "value": "Row 2" }, { "value": "Data" }] }
      ]
    }
  ]
}

Multiple merge ranges:

{
  "worksheets": [
    {
      "name": "Sheet1",
      "mergeCells": [
        { "from": { "row": 1, "col": 1 }, "to": { "row": 1, "col": 4 } },
        { "from": { "row": 3, "col": 1 }, "to": { "row": 5, "col": 1 } }
      ],
      "children": [
        { "cells": [{ "value": "Wide header" }] },
        { "cells": [{ "value": "A" }, { "value": "B" }] },
        { "cells": [{ "value": "Tall cell" }, { "value": "R3" }] },
        { "cells": [{ "value": null }, { "value": "R4" }] },
        { "cells": [{ "value": null }, { "value": "R5" }] }
      ]
    }
  ]
}

Column Widths

Define custom column widths using min and max to specify the column range:

{
  "worksheets": [
    {
      "name": "Sheet1",
      "columns": [
        { "min": 1, "max": 1, "width": 20 },
        { "min": 2, "max": 4, "width": 12 },
        { "min": 5, "max": 5, "width": 30 }
      ],
      "children": [
        {
          "cells": [
            { "value": "Wide" },
            { "value": "Med" },
            { "value": "Med" },
            { "value": "Med" },
            { "value": "Extra" }
          ]
        }
      ]
    }
  ]
}

Hidden Columns & Rows

{
  "worksheets": [
    {
      "name": "Sheet1",
      "columns": [
        { "min": 1, "max": 1, "width": 15 },
        { "min": 2, "max": 2, "width": 15, "hidden": true }
      ],
      "children": [
        { "cells": [{ "value": "Visible" }, { "value": "Hidden col" }] },
        { "cells": [{ "value": "Row 2" }, { "value": "Hidden col" }], "hidden": true }
      ]
    }
  ]
}

MergeCell Options Reference

OptionTypeDescription
from{ row: number, col: number }Top-left corner
to{ row: number, col: number }Bottom-right corner

Column Options Reference

OptionTypeDescription
minnumberFirst column in range (1-based)
maxnumberLast column in range (1-based)
widthnumberWidth in character units
hiddenbooleanHide the column
customWidthbooleanMark as custom width (auto-set)
Copyright © 2026