XLS to WebP API
Send an Excel 97-2003 file to POST /v2/convert/xls/to/webp for a lossless WebP of every printed page. The sample asks for portrait A5 paper with FitToPage=true, so all eight Fuel columns come back on one 874 × 1,240 page instead of two.
- Endpoint
- POST /v2/
convert/ xls/ to/ webp - Accepts
- xls
- Sample timing
- 0.839 s median of 5 runsHow we measure
- Request size
- Up to 10 MB on the Free plan or 100 MB on paid plans, all files together
Request and response
Every sample below ran against the API before this page was published. Set PDFCONVERSIONAPI_KEY to your key and run it as is.
curl -sS -X POST \
https://api.pdfconversionapi.com/v2/convert/xls/to/webp \
-H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
-F File=@van-fuel-log.xls \
--form-string PageSize=a5 \
--form-string PageOrientation=portrait \
--form-string FitToPage=true \
-o response.json
# FileData is base64. Save the first file in converted/,
# or print the JSON error.
if jq -e '.Files' response.json > /dev/null; then
mkdir -p converted
name=$(jq -r '.Files[0].FileName' response.json)
jq -r '.Files[0].FileData' response.json \
| base64 --decode > "converted/$name"
else
cat response.json
fiimport base64
import os
import requests
key = os.environ["PDFCONVERSIONAPI_KEY"]
response = requests.post(
"https://api.pdfconversionapi.com/v2/convert/xls/to/webp",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("van-fuel-log.xls", "rb"))],
data={
"PageSize": "a5",
"PageOrientation": "portrait",
"FitToPage": "true",
},
timeout=180,
)
result = response.json()
if not response.ok:
raise SystemExit(f"{result['Code']}: {result['Message']}")
os.makedirs("converted", exist_ok=True)
for file in result["Files"]:
path = os.path.join("converted", file["FileName"])
with open(path, "wb") as out:
out.write(base64.b64decode(file["FileData"]))
print(path, file["FileSize"], "bytes")
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
const form = new FormData();
const file = "van-fuel-log.xls";
form.append("File", new Blob([await readFile(file)]), file);
form.append("PageSize", "a5");
form.append("PageOrientation", "portrait");
form.append("FitToPage", "true");
const url = "https://api.pdfconversionapi.com/v2/convert/xls/to/webp";
const key = process.env.PDFCONVERSIONAPI_KEY;
const response = await fetch(url, {
method: "POST",
headers: { Authorization: `Bearer ${key}` },
body: form,
});
const result = await response.json();
if (!response.ok) {
throw new Error(`${result.Code}: ${result.Message}`);
}
await mkdir("converted", { recursive: true });
for (const file of result.Files) {
const path = join("converted", file.FileName);
await writeFile(path, Buffer.from(file.FileData, "base64"));
console.log(path, file.FileSize, "bytes");
}
{
"ConversionCost": 1,
"ConversionTime": 0.839,
"Files": [
{
"FileName": "van-fuel-log-1.webp",
"FileExt": "webp",
"FileSize": 41228,
"FileData": "UklGRgShAABXRUJQVlA4TPeg…"
},
{
"FileName": "van-fuel-log-2.webp",
"FileExt": "webp",
"FileSize": 29434,
"FileData": "UklGRvJyAABXRUJQVlA4TOVy…"
}
]
}Response from our test run on 2026-11-03. ConversionTime shows the median of 5 runs. FileData is shortened here; the real response carries the whole file as base64.
The sample, converted
The same file the code sends. Download the input and the output and compare them yourself.

- Input
- van-fuel-log.xls (11 KB)
- Output
- van-fuel-log-1.webp (40 KB)van-fuel-log-2.webp (29 KB)
- Source
- A fictional bakery's van fuel log in Excel 97-2003 format (two sheets, formulas, a cell note and a merged title) that we wrote for this site (CC0-1.0). How it was made
- Made by
- 2026-11-04, API build
9eeeb0640aba
Parameters
Send these as form fields next to the file. Names are case-insensitive. If you set one of the documented options below that we don't support yet, the request fails with a 400 that names it instead of returning a file made without it.
| Parameter | What it does |
|---|---|
PageSizeenum, default default | Paper for every printed sheet, in place of the Letter size saved in the sample. An a5 page is 874 × 1,240 pixels at the default 150 DPI. A name the API doesn't know, such as a6, returns 400 with the list of accepted sizes.Values: default, letter, legal, a3, a4, a5 and others |
PageOrientationenum, default default | Overrides the orientation saved for each sheet. Fuel is saved landscape; portrait stands it upright. On Letter paper the table still fits at full size, so portrait alone gave the same image as portrait with FitToPage=true.Values: default, portrait, landscape |
FitToPageboolean, default false | Make each printed sheet one page wide and as many pages tall as it needs. Portrait A5 is too narrow for the Fuel table: without this option its last two columns, Miles per gallon and Notes, move to a page of their own (3 images in all); with it the table is scaled down onto one page. |
Scaleinteger, default 100 | Percentage zoom instead of fitting. A scale replaces any fit-to-page setting saved in the sheet.Values: 10–300 |
ImageWidthinteger | Draw each page at this width in pixels, the height in proportion: ImageWidth=600 gave 600 × 464 for the wide Fuel page and 600 × 776 for Vans.Values: 1–20000 |
ImageResolutioninteger, default 150 | Pixels per inch when no size is given: a portrait A5 page is 874 × 1,240 at the default 150, a Letter page 1,275 × 1,650. WebP files carry no DPI value.Values: 36–600 |
WorksheetIndexinteger | Print only the sheet at this position; 1 is Fuel, 2 is Vans.Values: 1–2000 |
Passwordstring | Open password of an encrypted .xls; without it the answer is 422. |
Not supported yet
Setting one of these to anything but its default returns 400.
| Option | What to do instead |
|---|---|
ImageQuality | Pages are lossless WebP; any value but 75 returns 400 "ImageQuality is not supported yet for XLS → WebP". |
What carries over, and what doesn't
Kept
- All eight Fuel columns, Date to Notes, on one portrait A5 page, where the same request without
FitToPagesplits them over two - Highlight fills from conditional formatting and the wrapped two-line note
- Exact pixels: the WebP encoding is lossless
- The narrow Vans sheet at full size on its own A5 page, with its merged title: fitting only shrinks a sheet that is too wide
Lost or not yet supported
- There is no lossy WebP option, so
ImageQualityis refused. - Fitting shrinks everything on the page, the Fuel footer included, so small numbers get smaller; raise
ImageResolutionif they become hard to read. - Arial is replaced by the metric-compatible Liberation Sans.
- The cell note and the drop-down list are not shown.
Limits
- 2,000 pages per request and 16,000 pixels per side or 100 million pixels per image.
- Requests up to 10 MB on the Free plan or 100 MB on paid plans; 120 seconds per conversion before a 504 answer.
Where teams use it
Mobile-friendly previews of old spreadsheets
Portrait pages suit a phone screen better than landscape ones. Paper, orientation and fitting are set in the request, so the .xls itself is never edited.
Lighter images for a web gallery
Lossless WebP keeps every pixel and is smaller than PNG: the sample's first page is 41,228 bytes as WebP and 120,471 bytes as the same image in PNG.
Questions
What does FitToPage do exactly?
It sets each printed sheet to one page wide and as many pages tall as needed. A tall sheet still breaks into several pages; a wide one is scaled down instead of being split into column strips. A sheet that already fits, like the sample's Vans sheet, prints at full size.
Why is my ImageQuality request refused?
The WebP images are always lossless, so there is no quality to set, and the API refuses the option rather than ignoring it. Use /v2/convert/xls/to/jpg with ImageQuality when you need lossy compression.
Can I change orientation for just one sheet?
The page options apply to every printed sheet. To turn only one, print it alone with WorksheetName or WorksheetIndex and the orientation you want.
Convert your first XLS file in a minute.