JSON to Excel converter

Paste or upload JSON, check the table, then download it as an Excel (.xlsx) file. The conversion runs in your browser, so your data never leaves your computer. The download button on this page is vue3-json-to-excel, a Vue 3 component you can add to your own app.

How JSON becomes a spreadsheet

Vue 3 JSON to Excel: use the component in your app

The converter above is a thin page around one component. In your own Vue 3 app it renders a link, and a click builds the workbook with SheetJS and starts the download. There is no server involved.

Install it:

npm i vue vue3-json-to-excel

Use it with an object or an array of objects:

<vue3-json-to-excel :jsonData="{ hello: 'world', world: 'hello' }" />

Full example from the README:

<script>
import { defineComponent } from 'vue';
import Vue3JsonToExcel from 'vue3-json-to-excel';

export default defineComponent({
  name: 'ServeDev',
  components: {
    Vue3JsonToExcel
  }
});
</script>

<template>
  <div id="app">
    <vue3-json-to-excel fileName="myFile" buttonText="Download Halit's excel file" :jsonData="{ hello: 'world', world: 'hello' }" />
  </div>
</template>

The default export has an install() method, so you can also register it once for the whole app:

import { createApp } from 'vue';
import Vue3JsonToExcel from 'vue3-json-to-excel';
import App from './App.vue';

createApp(App).use(Vue3JsonToExcel).mount('#app');

Arrays and nested objects in jsonData need a release newer than 1.0.5. Version 1.0.5 on npm writes one flat object as a single row.

Options

Prop Type Required Default
jsonData Object or Array yes
fileName String no output (.xlsx is added to the name)
buttonText String no Download

The component renders a single <a> element, so a class or style you put on it lands on that link. The green button on this page is styled that way.

JSON to xlsx in JavaScript with SheetJS

Under the hood the component makes four SheetJS calls. If you are not using Vue, the same calls turn an array of flat objects into an .xlsx download in plain JavaScript:

import * as XLSX from 'xlsx';

const sheet = XLSX.utils.json_to_sheet(rows);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, sheet);
XLSX.writeFile(workbook, 'output.xlsx');

json_to_sheet cannot write an object into a cell, which is why the component flattens nested objects into dotted keys first.

FAQ

Is my JSON uploaded anywhere?

No. This is a static page on GitHub Pages with no backend. Your browser parses the JSON and SheetJS builds the .xlsx file on your computer.

Which JSON can I convert to Excel?

An array of objects, which gives one row per object, or a single object, which gives one row. Nested objects and arrays inside the objects are fine too. See how JSON becomes a spreadsheet.

Is there a size limit?

The converter sets none. Large files are limited by your browser's memory. The preview shows the first 50 rows, and the download has all of them.

Can I open the file in Google Sheets or LibreOffice?

Yes. The download is a standard .xlsx workbook, which Excel, LibreOffice Calc and Google Sheets all open.

Does the component work with Vue 2?

No. It is written for Vue 3 and lists vue ^3.0.5 as its peer dependency.