Spreadsheet to JSON

Convert spreadsheets from Excel, Numbers, CSV, TSV or other tabular format to JSON. A separate JSON object is output for each sheet.

Face with waiting expression Nothing to see yet!

Loading takeymakey...
TakeyMakey code
Want this tool to do something else? Edit the code below and make it do whatever you want.
import { read, utils } from "https://cdn.jsdelivr.net/npm/xlsx@0.18.5/+esm"

export const take = [
  { type: "file", label: "Spreadsheet", read: "buffer" },
  {
    type: "dropdown",
    label: "Format",
    options: [
      { label: "Use keys from first row" },
      { label: "Use column names for keys", value: "A" },
      { label: "Use nested arrays with no keys", value: 1 },
    ],
  },
  {
    type: "toggle",
    label: "Extract raw values",
    detail: "Use raw values, rather than formatted strings.",
    value: true,
  },
]

export const make = ([arrayBuffer, header, raw]) => {
  if (arrayBuffer) {
    const value = read(arrayBuffer)
    const opts = {
      raw,
      header,
    }

    return Object.entries(value.Sheets).map(([label, sheet]) => {
      return { type: "json", label, value: utils.sheet_to_json(sheet, opts) }
    })
  }
}