Excel template filler API
Fill an Excel .xlsx template with {placeholders} and repeated rows from JSON, keeping styles, formulas, merges and print setup; batch to a ZIP.
Upload your own .xlsx (the form your accountant or a government agency requires) with placeholders in cells and send the data as JSON. {so_hd} or {{so_hd}} inserts a value (dotted paths like {khach.ten} work, in any sheet); a cell that holds only a placeholder gets a real number, boolean or date (when the cell has a date format), so number formats such as #,##0 ₫ still apply. Filters: {tong|words} (amount in Vietnamese words), |money, |date (dd/mm/yyyy), |date_vi, |excel_date, |upper, |lower, |join, |default:….
A row that refers to an array ({items.ten}, {items.sl}, with {$index} for the line number) is repeated for each element. The engine edits the workbook XML directly, so cell styles, column widths, other sheets, images and print settings are untouched, and rows below move down: formulas are shifted (=SUM(E6:E6) becomes =SUM(E6:E8), =C6*D6 follows each copy), merged cells, conditional formatting, data validation, print areas and references from other sheets are updated, and Excel recalculates on open.
Send rows (an array) instead of data to produce one workbook per object in a ZIP, named with filename such as BG_{so}. action=tags lists the placeholders. Old .xls files, macros (.xlsm), pivot tables and Excel tables (ListObjects) over repeated rows are not adjusted. Files are processed in memory and not stored.
Markdown · OpenAPI · Postman · llms.txt
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
template | body | file | yes | The .xlsx template (multipart template or file, or template_base64). | |
data | body | object | no | Values for one workbook (JSON object). | |
rows | body | array | no | Batch: one workbook per object, returns a ZIP (max 500). | |
filename | body | string | no | workbook | Output name, with placeholders: BG_{so}. |
output | body|query | string | no | xlsx | xlsx (file) or json (tags, missing fields, base64). |
action | body|query | string | no | tags: list the placeholders only. |
Example
curl -X POST "https://apibox.io.vn/v1/xlsx-template" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "0=@./my-file"const form = new FormData();
form.append('0', fileInput.files[0]);
const res = await fetch('https://apibox.io.vn/v1/xlsx-template', {
method: 'POST',
headers: { Authorization: 'Bearer YOUR_API_KEY' },
body: form,
});
console.log(await res.json());import requests
res = requests.post(
"https://apibox.io.vn/v1/xlsx-template",
headers={"Authorization": "Bearer YOUR_API_KEY"},
files={"0": open("my-file", "rb")},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/xlsx-template');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
CURLOPT_POSTFIELDS => ['0' => new CURLFile('my-file')],
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"filename": "workbook.xlsx",
"sheets": [
"Bao_gia",
"Ky"
],
"tags": [
{
"name": "so",
"cells": [
"Bao_gia!A1"
]
},
{
"name": "khach.ten",
"cells": [
"Bao_gia!A2"
]
},
{
"name": "ngay",
"cells": [
"Bao_gia!B3"
]
},
{
"name": "$index",
"cells": [
"Bao_gia!A6"
]
},
{
"name": "items.ten",
"cells": [
"Bao_gia!B6"
]
},
{
"name": "items.sl",
"cells": [
"Bao_gia!C6"
]
},
{
"name": "items.gia",
"cells": [
"Bao_gia!D6"
]
},
{
"name": "tong|words",
"cells": [
"Bao_gia!A8"
]
},
{
"name": "ghi_chu",
"cells": [
"Bao_gia!A9"
]
},
{
"name": "nguoi_lap",
"cells": [
"Ky!A1"
]
}
],
"repeated_rows": 1,
"missing_fields": [
"ghi_chu",
"nguoi_lap"
],
"xlsx_base64": "UEsDBBQAAAgIAAAAAACI4g+7GgEAALcDAAATAAAAW0NvbnRlbnRfVHlwZXNd…",
"bytes": 3543
}
Use cases
- Fill quotation, invoice or delivery templates with line items
- Produce tax and insurance declaration forms that must keep the official layout
- Mail-merge payslips or certificates into a ZIP of workbooks
- Generate periodic reports from Google Sheets / n8n data into a fixed template
FAQ
Do my formulas still work after rows are inserted?
Yes. References below the repeated rows are shifted, ranges that cover the template row grow with it, and the workbook is set to recalculate when opened.
Can a placeholder be part of a longer text?
Yes: "Khách hàng: {khach.ten}" becomes a text cell. A cell containing only a placeholder keeps the value type (number, date, boolean).
What if an array is empty?
The template row is kept once with blank cells, so totals and formulas over it stay valid.
Related APIs
Image Metadata & EXIF
Read image dimensions, format, EXIF camera data, capture settings and GPS location from JPEG, PNG, WebP, HEIC, AVIF, GIF and more – upload or URL.
PDFPDF Metadata
Read PDF metadata: page count, title, author, creator, producer, dates, PDF version, encryption, form fields and the size of each page (A4, Letter…).
PDF₫Quote & Receipt PDF
Generate clean PDF quotations, receipts, orders and simple invoices from JSON, with Vietnamese text, VAT, totals in words and a VietQR code for payment.