Skip to content

Props ​

NameTypeDefaultDescription
dataArrayData to be exported.
fieldsObjectFields inside the JSON objects to export, as { 'Column label': 'path.to.value' }. If none are provided, every property is exported. See Callbacks for formatting.
export-fieldsObjectSame as fields. Use it when another library (e.g. vee-validate) already uses a fields attribute.
typeStringxlsFile type: xls, xlsx or csv.
nameStringdata.xlsFile name of the download.
headerString | ArrayTitle row(s) above the data. A string for one title, an array of strings for several.
title deprecatedString | ArraySame as header, kept for backwards compatibility. Avoid it: it conflicts with the HTML title attribute.
per-columns-headersArrayOne header per column, e.g. ['Col A', , 'Col C'].
footerString | ArrayFooter row(s) below the data. A string for one footer, an array of strings for several.
default-valueString''Fallback used when a row has no value for a field.
worksheetStringSheet1Name of the worksheet tab.
metaArray[]Extra <meta> tags for the xls file, e.g. [[{ key: 'charset', value: 'utf-8' }]].
fetchFunctionCallback that returns the data when the user clicks. Only used when no data is set. See Fetch data on demand.
before-generateFunctionCalled right before the data is fetched / generated, e.g. to show a loader.
before-finishFunctionCalled right before the download dialog opens, e.g. to hide a loader.
formatsObject{}xlsx only. Cell number formats keyed by column letter, e.g. { B: '0.00%' }. See Cell formats.
widthsObject{}xlsx only. Column widths in characters keyed by column letter, e.g. { A: 20 }. 1.0.26+
stringify-long-numBooleanfalseStringify long numbers and decimals so they don't lose precision.
escape-csvBooleantrueWraps every CSV value in =" and " to stop Excel mangling number-like fields. Set to false to disable.
emit-blobBooleanfalseEmit the generated file as a blob event instead of downloading it.
debounceNumber500Debounce delay (ms) of the download click.
rtlBooleanfalseRight-to-left worksheet.

Events ​

NamePayloadDescription
blobBlobEmitted with the generated file when emit-blob is true.
vue
<JsonExcel :data="data" type="xlsx" emit-blob @blob="(file) => upload(file)">
  Upload as Excel
</JsonExcel>

Released under the MIT License.