xlsx2echarts v1.0.0

REST API

Base URL: https://jev.fishmaple.cn/excelECharts · OpenAPI: api/openapi.json · Swagger UI

MethodPathDescription
GET/api/v1/healthversion, max upload, rate limits
POST/api/v1/convertmultipart 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).

SDK — TypeScript / JavaScript (primary)

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.

SDK — Python

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));

CLI

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).

Mapping

Excel (DrawingML)ECharts
barChart / bar3DChart, barDir col|barseries.type bar; bar → category on yAxis
grouping clustered / stacked / percentStacked— / series.stack / stack + values normalised to %, axis 0–100%
gapWidth, overlapbarCategoryGap, barGap
lineChart (marker, smooth, stacked)line, symbol / showSymbol, smooth, stack
areaChartline + 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
bubbleChartscatter with per-point symbolSize
radarChart (marker/filled)radar + indicator
several chart groups in one plotAreacombo series; axId → xAxisIndex / yAxisIndex (secondary axis right)
dateAxcategory with formatted dates, or time axis for uneven dates
title, legend legendPos, axis title / min / max / majorUnit / logBase / orientation, gridlinestitle, legend, axis name / min / max / interval / log / inverse, splitLine
dLbls showVal / showPercent / showCatName / showSerName, dLblPoslabel.formatter {c} {d}% {b} {a}, label.position
spPr solidFill srgbClr / schemeClr (+lumMod/lumOff/tint/shade), dPtitemStyle.color (theme resolved), per-point colours