typed-xlsx
Workbook

Sheet Options

Options for .sheet(name, options), freeze panes, table layout, right-to-left sheets and protection.

.sheet(name, options) takes the same options in the buffered and streaming builders.

OptionDefaultPurpose
freezePane{ rows, columns } that stay visible while scrolling
tablesPerRow1how many tables sit side by side before wrapping to a new row
tableColumnGap1empty columns between side-by-side tables
tableRowGap1empty rows between stacked tables
rightToLeftfalsemirror the sheet for right-to-left languages
protectiontrue or permissions, see Protection

Freeze panes

Freeze the rows a reader needs while scrolling, usually the title and header rows, and the identifying columns on wide reports.

import { 
createExcelSchema
,
createWorkbook
} from "typed-xlsx";
type
Account
= {
account
: string;
jan
: number;
feb
: number;
mar
: number };
const
schema
=
createExcelSchema
<
Account
>()
.
column
("account", {
header
: "Account",
accessor
: "account" })
.
column
("jan", {
header
: "Jan",
accessor
: "jan" })
.
column
("feb", {
header
: "Feb",
accessor
: "feb" })
.
column
("mar", {
header
: "Mar",
accessor
: "mar" })
.
build
();
createWorkbook
()
.
sheet
("Revenue", {
freezePane
: {
rows
: 2,
columns
: 1 } })
.
table
("revenue", {
title
: "Monthly revenue",
schema
,
rows
: [] });
A
B
C
D
1
2
3
4
5
Monthly revenue
Account
Jan
Feb
Mar
Acme
4,200
4,400
4,900
Globex
8,750
8,100
9,300
Initech
1,200
1,300
1,250
1
2
  1. 1A1:D2frozen rows: the title and the header stay on screen
  2. 2A3:A5frozen column: the account name stays visible when scrolling right

freezePane counts worksheet rows and columns, so with a table title the header is row 2.

Layout of several tables

tablesPerRow, tableColumnGap and tableRowGap decide where each .table() lands. Building Workbooks shows both layouts.

import { 
createWorkbook
} from "typed-xlsx";
createWorkbook
().
sheet
("Dashboard", {
tablesPerRow
: 3,
tableColumnGap
: 2,
tableRowGap
: 2 });

Right-to-left

import { 
createWorkbook
} from "typed-xlsx";
createWorkbook
().
sheet
("تقرير", {
rightToLeft
: true });

Names and limits

Sheet names are cleaned (\ / * ? : [ ] | become spaces), cut to 31 characters and made unique ignoring case, so Sales and sales become Sales and sales (2). History is reserved by Excel, so a sheet with that name becomes History (2). A hyperlink such as #'Sheet'!A1 must use the final name.

Excel allows 1,048,576 rows and 16,384 columns per sheet. A workbook that would pass either limit throws an error naming the sheet instead of writing a file Excel cannot open.

Copyright © 2026 Cyprien Thao. Released under the MIT License.