Sign inSign up

tuitentuan/excel-tools

By tuitentuan

•Updated 5 days ago

A powerful and flexible API that provides advanced functionality for working with Excel files.

Image
0

163

tuitentuan/excel-tools repository overview

⁠ExcelTools API

Process Excel files through a simple HTTP API — no Excel install, no desktop automation, no client-side coding.

Upload a workbook, queue formatting and processing operations, download the result. Built on ASP.NET Core and EPPlus⁠, packaged as a single self-contained container you can run anywhere Docker runs.


⁠Why ExcelTools?

API-first ExcelIntegrate spreadsheet processing into backends, scripts, and RPA without Office on the server
Zero client setupCallers only need HTTP + an API key
Operation pipelineChain cell styling (font, fill, border, alignment, merge, column/row sizing) — more operations coming
Secure by defaultAPI-key authentication on every protected route
Production-ready containerNon-root user, health endpoint, SQLite persistence, background job worker
Fully configurableAuth, storage, sessions, workers, and EPPlus license via environment variables

⁠Quick start

docker run -d \
  --name exceltools \
  -p 8080:8080 \
  -e Auth__ApiKeys__0="change-me-to-a-strong-secret" \
  -e EPPlus__ExcelPackage__License="NonCommercialPersonal:YourName" \
  -v exceltools-data:/app/Storages \
  YOUR_DOCKERHUB_USER/exceltools:latest

Replace YOUR_DOCKERHUB_USER/exceltools with your published image name.

Health check:

curl http://localhost:8080/health

Send every API request with:

x-api-key: change-me-to-a-strong-secret
⁠Minimal workflow
  1. Upload — POST /api/Session (multipart/form-data, field file, .xlsx)
  2. Process — POST /api/ExcelProcess/process with sessionId, worksheet name, and operations
  3. Poll — GET /api/ExcelProcess/{processId} or GET /api/Session/{sessionId}
  4. Download — GET /api/Session/{sessionId}/download when status is Completed

Example styling request:

{
  "sessionId": "<from-upload>",
  "worksheet": "Sheet1",
  "operations": [
    {
      "targetType": "Cell",
      "target": "A1:C1",
      "operationType": "Styling",
      "parameters": {
        "font": { "bold": true, "color": "#FFFFFF" },
        "fill": { "backgroundColor": "#1F4E79" },
        "alignment": { "horizontal": "Center", "vertical": "Center" }
      }
    }
  ]
}

⁠Ports & volumes

ItemDefaultNotes
HTTP port8080Mapped with -p 8080:8080
Data volume/app/StoragesSQLite DB + uploaded/processed files — mount a volume for persistence

Without a volume, all sessions and files are lost when the container is removed.


⁠Environment variables

ASP.NET Core maps nested settings with __ (double underscore). Array items use __0, __1, …

⁠Required
VariableDescriptionExample
Auth__ApiKeys__0At least one API key. Container will not start if no keys are configured.Auth__ApiKeys__0=my-secret-key

Add more keys with Auth__ApiKeys__1, Auth__ApiKeys__2, …

VariableDescriptionExample
Auth__ApiKeys__1Additional accepted API keyAuth__ApiKeys__1=second-key

Clients must send the key in header: x-api-key: <value>


VariableDescriptionDefault (image)Example
EPPlus__ExcelPackage__LicenseEPPlus license string for your use case. Override the baked-in value for your org / commercial license. See EPPlus licensing⁠.Value from image appsettings.jsonNonCommercialPersonal:YourName or your commercial license string
ASPNETCORE_ENVIRONMENTHosting environmentProduction (typical in containers)Production
ASPNETCORE_URLSListen URLs (optional if using port env vars)Kestrel default in imagehttp://+:8080
ASPNETCORE_HTTP_PORTSHTTP ports Kestrel binds8080 (common for this image)8080

⁠Auth
VariableRequiredDefaultDescription
Auth__ApiKeys__0Yes(empty — startup fails)First API key
Auth__ApiKeys__NNo—Additional keys (N = 1, 2, …)

⁠Storage & database
VariableRequiredDefaultDescription
Storage__RootPathNoStoragesRoot folder for DB + files (relative to app, or absolute path). Prefer mounting /app/Storages.
Storage__DatabaseRelativePathNoDatabases/exceltools.dbSQLite file path under root
Storage__FilesRelativePathNoFilesUploaded/processed files folder under root
Storage__MaxUploadBytesNo99614720 (~95 MB)Max upload size in bytes (also applied to multipart form limit)
Storage__OriginalFileNamePrefixNooriginal_Prefix for stored original files
Storage__ProcessedFileNamePrefixNoprocessed_Prefix for processed files
ConnectionStrings__DefaultNoData Source=Storages/Databases/exceltools.dbSQLite connection string. If unset, derived from storage paths.

Persistence tip: mount a volume on /app/Storages (or set Storage__RootPath to your mount point) so the database and files survive restarts.


⁠Session lifecycle
VariableRequiredDefaultDescription
Session__TtlNo1.00:00:00 (24 hours)How long a session lives before cleanup (TimeSpan)
Session__CleanupIntervalNo00:15:00How often expired sessions/files are cleaned (TimeSpan)

TimeSpan formats: d.hh:mm:ss or hh:mm:ss (e.g. 12:00:00 = 12 hours, 00:30:00 = 30 minutes).


⁠Processing / workers
VariableRequiredDefaultDescription
Processing__WorkerCapacityNo1Job-queue worker capacity (minimum effective value is 1)
Processing__MaxProcessingTimeNo00:15:00Max processing time setting (TimeSpan)
Processing__AllowedFileExtensions__0No.xlsxAllowed upload extension (index 0)
Processing__AllowedFileExtensions__NNo—Additional extensions if you expand support later

To replace the default extension list via env, set the indices you need, for example:

-e Processing__AllowedFileExtensions__0=".xlsx"

⁠Logging & hosting
VariableRequiredDefaultDescription
Logging__LogLevel__DefaultNoInformationDefault log level
Logging__LogLevel__Microsoft.AspNetCoreNoWarningASP.NET Core framework log level
AllowedHostsNo*Host filtering allow-list

⁠Full example (docker run)

docker run -d \
  --name exceltools \
  --restart unless-stopped \
  -p 8080:8080 \
  -e ASPNETCORE_ENVIRONMENT=Production \
  -e ASPNETCORE_HTTP_PORTS=8080 \
  -e Auth__ApiKeys__0="prod-key-alpha" \
  -e Auth__ApiKeys__1="prod-key-beta" \
  -e EPPlus__ExcelPackage__License="NonCommercialPersonal:YourName" \
  -e Storage__RootPath="/app/Storages" \
  -e Storage__MaxUploadBytes=99614720 \
  -e Session__Ttl="1.00:00:00" \
  -e Session__CleanupInterval="00:15:00" \
  -e Processing__WorkerCapacity=1 \
  -e Processing__MaxProcessingTime="00:15:00" \
  -e Processing__AllowedFileExtensions__0=".xlsx" \
  -e Logging__LogLevel__Default=Information \
  -v exceltools-data:/app/Storages \
  YOUR_DOCKERHUB_USER/exceltools:latest

⁠Docker Compose example

services:
  exceltools:
    image: YOUR_DOCKERHUB_USER/exceltools:latest
    container_name: exceltools
    restart: unless-stopped
    ports:
      - "8080:8080"
    environment:
      ASPNETCORE_ENVIRONMENT: Production
      ASPNETCORE_HTTP_PORTS: "8080"
      Auth__ApiKeys__0: "${EXCELTOOLS_API_KEY}"
      EPPlus__ExcelPackage__License: "${EPPLUS_LICENSE}"
      Storage__RootPath: /app/Storages
      Storage__MaxUploadBytes: "99614720"
      Session__Ttl: "1.00:00:00"
      Session__CleanupInterval: "00:15:00"
      Processing__WorkerCapacity: "1"
      Processing__MaxProcessingTime: "00:15:00"
      Processing__AllowedFileExtensions__0: ".xlsx"
      Logging__LogLevel__Default: Information
    volumes:
      - exceltools-data:/app/Storages
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 5s
      retries: 3
      start_period: 10s

volumes:
  exceltools-data:

Create a .env next to compose (do not commit secrets):

EXCELTOOLS_API_KEY=change-me-to-a-strong-secret
EPPLUS_LICENSE=NonCommercialPersonal:YourName

⁠API overview

MethodPathAuthPurpose
GET/healthNoLiveness
POST/api/SessionYesUpload .xlsx
GET/api/Session/{sessionId}YesSession status
GET/api/Session/{sessionId}/downloadYesDownload processed file (when Completed)
GET/api/Session/{sessionId}/download-alwaysYesDownload processed if present, else original
POST/api/ExcelProcess/processYesEnqueue operations
GET/api/ExcelProcess/{processId}YesProcess status

Optional upload header: x-request-by: <caller-id>


⁠Current capabilities

  • Styling operations on cells/ranges: font, fill, alignment, borders, merge, column width / auto-fit, row height
  • Background job processing with status polling
  • Automatic session expiry and cleanup
  • SQLite-backed metadata (no external database required)

More Excel operations are planned for future image tags.


⁠Security notes

  • Treat Auth__ApiKeys__* as secrets — use Docker secrets, Compose .env, or your orchestrator’s secret store
  • Prefer HTTPS via a reverse proxy (Traefik, Nginx, Caddy, cloud LB) in front of port 8080
  • Rotate API keys by adding a new key, updating clients, then removing the old index
  • Set a correct EPPlus license for your deployment; non-commercial personal licenses are not for commercial production use

⁠Troubleshooting

SymptomWhat to check
Container exits immediatelyAuth__ApiKeys__0 missing or empty
401 / unauthorizedHeader x-api-key must match a configured key
Upload rejectedFile empty, wrong extension, or over Storage__MaxUploadBytes
Download 409Session not Completed yet — poll status
Data lost after recreateMount a volume on /app/Storages
EPPlus license errorsSet EPPlus__ExcelPackage__License to a valid license string

⁠License

Application usage depends on your deployment terms. EPPlus requires a valid license configuration via EPPlus__ExcelPackage__License. Review EPPlus License Overview⁠ before commercial use.

Tag summary

Content type

Image

Digest

sha256:0d6292c3d…

Size

112.7 MB

Last updated

5 days ago

docker pull tuitentuan/excel-tools:v1.2.1.1