---
url: https://vue-json-excel3.netlify.app/multi-line-examples.md
description: >-
  Values containing newline characters stay in a single Excel cell instead of
  being split across rows.
---

# Multi-line Values

A text value that contains newline characters (`\n`) appears as a **single cell** in Excel. This avoids multi-line values being split into several cells that must be merged before you can use filters and pivot tables.

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

const dataForExcel = [
  { colA: 'Hello', colB: 'World' },
  {
    colA: 'Multi-line',
    // Newlines stay inside a single cell
    colB: 'This is a long paragraph\nwith multiple lines\nthat should show in a single cell.',
  },
  { colA: 'Another', colB: 'Regular cell' },
]
</script>

<template>
  <JsonExcel class="btn" :data="dataForExcel" name="multi-line.xls">
    Download multi-line example
  </JsonExcel>
</template>
```

The result in Excel:

![Excel showing a multi-line value in a single cell](./example-multi-line.png)
