---
url: https://vue-json-excel3.netlify.app/getting-started.md
description: >-
  Install vue-json-excel3, register the component locally or globally, and
  download your first Excel or CSV file.
---

# Getting Started

## Installation

::: code-group

```bash [npm]
npm install vue-json-excel3
```

```bash [pnpm]
pnpm add vue-json-excel3
```

```bash [yarn]
yarn add vue-json-excel3
```

```bash [bun]
bun add vue-json-excel3
```

:::

`vue` (version 3) is the only peer dependency.

## Register the component

### Locally

Import it in the component that needs it:

```vue [MyComponent.vue]
<script setup>
import JsonExcel from 'vue-json-excel3'
</script>
```

### Globally

Or register it once in your app entry point:

```js [main.js]
import { createApp } from 'vue'
import JsonExcel from 'vue-json-excel3'
import App from './App.vue'

const app = createApp(App)
app.component('downloadExcel', JsonExcel)
app.mount('#app')
```

## Use it in your template

Wrap any content — text, an icon, your own button — and pass the data to export. Clicking it downloads the file.

```html
<download-excel :data="json_data">
  Download Data
  <img src="download_icon.png" />
</download-excel>
```

Set [`type`](/props) to `xlsx` or `csv` to change the file format, and use [`fields`](/simple-examples) to choose and label the columns. Every option is listed on the [Props](/props) page.

::: warning About the .xls format
The default `xls` type uses an HTML table to build the file. Microsoft Excel no longer recognises HTML as native content, so it shows a warning before opening the file. The content renders correctly, but the message can't be avoided — use `type="xlsx"` to get a native workbook without the warning.
:::

## Next steps
