Base URL: https://jev.fishmaple.cn/excelECharts · OpenAPI: api/openapi.json · Swagger UI
| Method | Path | Description |
|---|---|---|
| GET | /api/v1/health | version, max upload, rate limits |
| POST | /api/v1/convert | multipart file (.xlsx/.xlsm/.xltx/.xltm, ≤10 MB); optional show_missing_axes=true; optional geojson file (GeoJSON FeatureCollection for filled maps) |
curl -s -F file=@book.xlsx https://jev.fishmaple.cn/excelECharts/api/v1/convert
{
"ok": true, "version": "1.0.0", "filename": "book.xlsx", "sheets": ["Sheet1"],
"evaluatedFormulas": 0, "warnings": [],
"charts": [{
"index": 0, "id": "chart1", "part": "xl/charts/chart1.xml",
"sheet": "Sheet1", "anchor": "F2:P20", "name": "Chart 1", "title": "Sales",
"width": 640, "height": 360, "types": ["barChart", "lineChart"], "warnings": [],
"option": { "title": {...}, "legend": {...}, "xAxis": {...}, "yAxis": [...], "series": [...],
"x-numFmt": [{"path": "yAxis.1.axisLabel", "formatCode": "0%"}] }
}]
}
Errors — {"ok":false,"error":{"code","message"}}: 400 EMPTY_FILE · 413 FILE_TOO_LARGE · 415 NOT_XLSX · 422 CONVERT_FAILED · 429 RATE_LIMITED (Retry-After) · 504 TIMEOUT.
x-numFmt: ECharts JSON cannot contain functions, so Excel number formats (e.g. 0%, #,##0.00, dates) are listed as hooks. Load x2e-runtime.js and call chart.setOption(X2E.prepare(option)), or just delete the key. prepare() also attaches renderItem to custom series marked "x-renderItem" (error bars, box & whisker means/outliers/points).
npm package excel-echarts — zero runtime dependencies, works in Node ≥18 and modern browsers (own ZIP reader + XML parser; inflate via node:zlib or DecompressionStream). Not on the npm registry yet; install the tarball:
npm i https://github.com/fishstormX/excel2Echarts/releases/download/v1.0.0/excel-echarts-1.0.0.tgz
import { convertXlsx, prepare } from "excel-echarts";
const { charts } = await convertXlsx("book.xlsx"); // Node: path | Uint8Array | ArrayBuffer | Blob
echarts.init(el).setOption(prepare(charts[0].option)); // prepare() applies x-numFmt formatters
Browser without a bundler: <script src="https://jev.fishmaple.cn/excelECharts/excel-echarts.browser.js"></script> → await ExcelECharts.convertXlsx(await file.arrayBuffer()). ES module: dl/excel-echarts.esm.js.
Same behaviour and byte-identical JSON (checked by a parity test). Pure stdlib (zipfile + xml.etree), Python ≥3.8.
pip install https://github.com/fishstormX/excel2Echarts/releases/download/v1.0.0/excel_echarts-1.0.0-py3-none-any.whl
from xlsx2echarts import convert_xlsx
res = convert_xlsx("book.xlsx") # path, bytes or file object
for c in res["charts"]:
print(c["sheet"], c["anchor"], c["title"], c["types"])
option = c["option"]
Calling the public API from Python:
import requests
r = requests.post("https://jev.fishmaple.cn/excelECharts/api/v1/convert", files={"file": open("book.xlsx", "rb")})
charts = r.json()["charts"]
JavaScript:
const fd = new FormData(); fd.append("file", fileInput.files[0]);
const j = await (await fetch("https://jev.fishmaple.cn/excelECharts/api/v1/convert", {method: "POST", body: fd})).json();
echarts.init(el).setOption(X2E.prepare(j.charts[0].option));
Node: excel-echarts (alias xlsx2echarts; or npx excel-echarts after installing). Python: xlsx2echarts / excel-echarts / python -m xlsx2echarts. Same flags and output layout.
excel-echarts book.xlsx -o out/ # out/<sheet>_chartN.json + index.json + preview.html
excel-echarts a.xlsx b.xlsx ./folder -o out/ # several files → out/<file>/...
excel-echarts book.xlsx --stdout # print JSON
excel-echarts book.xlsx --show-missing-axes # show axes Excel hides
preview.html renders every chart with a locally vendored echarts.min.js (no CDN).
| Excel (DrawingML) | ECharts |
|---|---|
| barChart / bar3DChart, barDir col|bar | series.type bar; bar → category on yAxis |
| grouping clustered / stacked / percentStacked | — / series.stack / stack + values normalised to %, axis 0–100% |
| gapWidth, overlap | barCategoryGap, barGap |
| lineChart (marker, smooth, stacked) | line, symbol / showSymbol, smooth, stack |
| areaChart | line + areaStyle (stack when stacked) |
| pieChart / doughnutChart (holeSize, firstSliceAng, explosion) | pie, radius [inner, outer], startAngle, selected |
| scatterChart (scatterStyle, ln noFill) | scatter (markers) or line on value axis |
| bubbleChart | scatter with per-point symbolSize |
| radarChart (marker/filled) | radar + indicator |
| several chart groups in one plotArea | combo series; axId → xAxisIndex / yAxisIndex (secondary axis right) |
| dateAx | category with formatted dates, or time axis for uneven dates |
| title, legend legendPos, axis title / min / max / majorUnit / logBase / orientation, gridlines | title, legend, axis name / min / max / interval / log / inverse, splitLine |
| dLbls showVal / showPercent / showCatName / showSerName, dLblPos | label.formatter {c} {d}% {b} {a}, label.position |
| spPr solidFill srgbClr / schemeClr (+lumMod/lumOff/tint/shade), dPt | itemStyle.color (theme resolved), per-point colours |
基础地址:https://jev.fishmaple.cn/excelECharts · OpenAPI:api/openapi.json · Swagger UI
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /api/v1/health | 版本、上传上限、限流规则 |
| POST | /api/v1/convert | multipart 字段 file(.xlsx/.xlsm/.xltx/.xltm,≤10 MB);可选 show_missing_axes=true;可选 geojson 文件(着色地图用的 GeoJSON FeatureCollection) |
curl -s -F file=@表格.xlsx https://jev.fishmaple.cn/excelECharts/api/v1/convert
返回 charts[],每项含 sheet(所在工作表)、anchor(覆盖的单元格区域)、title、types(Excel 图表组)、warnings 和 option(ECharts 配置)。
错误:{"ok":false,"error":{"code","message"}};400 空文件 · 413 文件过大 · 415 不是 xlsx · 422 解析失败 · 429 限流(带 Retry-After)· 504 超时。
x-numFmt:ECharts JSON 里不能放函数,所以 Excel 数字格式(如 0%、#,##0.00、日期)以钩子形式列出。引入 x2e-runtime.js 后 chart.setOption(X2E.prepare(option)) 即可,不需要就删掉该字段。prepare() 同时为带 "x-renderItem" 的 custom 系列(误差线、箱形图均值/离群点)挂上 renderItem。
npm 包 excel-echarts:零运行时依赖,Node ≥18 与现代浏览器通用(自带 ZIP 读取与 XML 解析)。尚未发布到 npm,先装 tarball:
npm i https://github.com/fishstormX/excel2Echarts/releases/download/v1.0.0/excel-echarts-1.0.0.tgz
import { convertXlsx, prepare } from "excel-echarts";
const { charts } = await convertXlsx("表格.xlsx");
echarts.init(el).setOption(prepare(charts[0].option));
浏览器直接引用:<script src="https://jev.fishmaple.cn/excelECharts/excel-echarts.browser.js"> → await ExcelECharts.convertXlsx(await file.arrayBuffer())。
行为一致,输出 JSON 与 TS 版完全相同(有对比测试)。只用标准库,Python ≥3.8。
pip install https://github.com/fishstormX/excel2Echarts/releases/download/v1.0.0/excel_echarts-1.0.0-py3-none-any.whl
from xlsx2echarts import convert_xlsx
res = convert_xlsx("表格.xlsx")
for c in res["charts"]:
print(c["sheet"], c["anchor"], c["title"], c["types"])
Node:excel-echarts(别名 xlsx2echarts);Python:xlsx2echarts / python -m xlsx2echarts,参数与输出相同。
excel-echarts 表格.xlsx -o out/ # 每个图表一个 JSON + index.json + preview.html
excel-echarts a.xlsx b.xlsx ./目录 -o out/
excel-echarts 表格.xlsx --stdout
excel-echarts 表格.xlsx --show-missing-axes # 显示 Excel 会隐藏的坐标轴
映射表与已知限制见英文版 Mapping 或项目 README(中文)。