TabularJS
All examples
framework

Next.js App Router API route

Server-side conversion via an uploaded file.

Create a POST route that accepts multipart form data and returns the parsed JSON. Pure server code — the client never needs to load the parser.

ts
// app/api/convert/route.ts
import tabularjs from 'tabularjs';

export async function POST(req: Request) {
  const form = await req.formData();
  const file = form.get('file') as File;

  const buffer = Buffer.from(await file.arrayBuffer());
  const result = await tabularjs(buffer, { name: file.name });

  return Response.json(result);
}

Live Preview

Sample output for a file with employee data.

stdout
{
  "worksheets": [
    {
      "name": "Sheet1",
      "data": [
        ["Name", "Department", "Salary", "Start Date"],
        ["Alice Johnson", "Engineering", 95000, "2021-03-15"],
        ["Bob Smith", "Marketing", 72000, "2022-01-10"],
        ["Carol Williams", "Engineering", 88000, "2020-07-22"],
        ["David Brown", "Design", 68000, "2023-02-08"],
        ["Eve Davis", "Engineering", 102000, "2019-11-30"]
      ]
    }
  ]
}