---
url: https://vue-json-excel3.netlify.app/export-csv-examples.md
description: Export JSON as a CSV file by setting the type prop to csv.
---

# Export CSV

To export JSON as a CSV file, set the `type` prop to `"csv"`.

```vue
<script setup>
import JsonExcel from 'vue-json-excel3'

const jsonFields = {
  'Complete name': 'name',
  City: 'city',
  Telephone: 'phone.mobile',
  'Telephone 2': {
    field: 'phone.landline',
    callback: (value) => `Landline Phone - ${value}`,
  },
}

const jsonData = [
  {
    name: 'Tony Peña',
    city: 'New York',
    country: 'United States',
    birthdate: '1978-03-15',
    phone: { mobile: '1-541-754-3010', landline: '(541) 754-3010' },
  },
  {
    name: 'Thessaloniki',
    city: 'Athens',
    country: 'Greece',
    birthdate: '1987-11-23',
    phone: { mobile: '+1 855 275 5071', landline: '(2741) 2621-244' },
  },
]
</script>

<template>
  <JsonExcel
    class="btn"
    :data="jsonData"
    :fields="jsonFields"
    type="csv"
    worksheet="My Worksheet"
    name="filename.csv"
  >
    Download CSV
  </JsonExcel>
</template>
```

::: tip Number-like values
By default every CSV value is wrapped in `="` and `"` so Excel doesn't strip leading zeros or turn long numbers into scientific notation. Set `:escape-csv="false"` to export plain values.
:::
