API Overview
xlmake's API is divided into two main parts.
Entry Points
xlmake()
Creates a builder for generating Excel files.
import { xlmake } from "xlmake";
const builder = xlmake();
read()
Reads existing Excel files.
import { read } from "xlmake";
const workbook = await read("report.xlsx");
Method Reference
WorkbookBuilder / SheetBuilder
| Method | Returns | Description |
|---|---|---|
sheet(name?) | SheetBuilder | Add sheet (auto-generated name if omitted) |
table(options) | this | Add table |
text(input) | this | Add text |
image(options) | this | Add image |
space(lines?) | this | Add empty rows (default: 1) |
getNode() | Promise<NodeOutput> | Get Node.js output object |
getBrowser() | Promise<BrowserOutput> | Get browser output object |
NodeOutput
| Method | Returns | Description |
|---|---|---|
saveToFile(path) | Promise<void> | Save to file |
toBuffer() | Promise<Buffer> | Get as Buffer |
BrowserOutput
| Method | Returns | Description |
|---|---|---|
download(filename) | Promise<void> | Download file |
Basic Flow
xlmake() → sheet() → table() / text() / image() → getNode() / getBrowser()
const output = await xlmake()
.sheet("Sheet Name")
.table({ columns: [...], data: [...] })
.getNode();
await output.saveToFile("output.xlsx");