3.1.0 • Published 2 years ago

@runnerty/executor-excel2csv v3.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

NPM version Downloads Dependency Status

Executor for Runnerty: Excel2CSV (xlsx to csv)

Installation:

Through NPM

npm i @runnerty/executor-excel2csv

You can also add modules to your project with runnerty

npx runnerty add @runnerty/executor-excel2csv

This command installs the module in your project, adds example configuration in your config.json and creates an example plan of use.

If you have installed runnerty globally you can include the module with this command:

runnerty add @runnerty/executor-excel2csv

Configuration:

Add in config.json:

{
  "id": "excel2csv_default",
  "type": "@runnerty-executor-excel2csv"
}

Plan:

Add in plan.json:

{
  "id": "excel2csv_default",
  "inputPath": "./test.xlsx",
  "outputPath": "./test.csv"
}
{
  "id": "excel2csv_default",
  "inputPath": "./test.xlsx",
  "outputPath": "./test.csv",
  "options": {
    "sheetName": "SHEET_ONE",
    "dateFormat": "DD/MM/YYYY",
    "formatterOptions": {
      "quote": "'",
      "delimiter": ";"
    }
  }
}

Options:

ParameterTypeDescription
dateFormatStringSpecify the date encoding format of dayjs.
dateUTCBooleanSpecify whether ExcelJS uses dayjs.utc () to convert time zone for parsing dates.
encodingStringSpecify file encoding format. (Only applies to .writeFile.)
includeEmptyRowsBooleanSpecifies whether empty rows can be written.
sheetNameStringSpecify worksheet name.
sheetIdNumberSpecify worksheet ID.
formatterOptionsObjectSee below.

Options/formatterOptions:

ParameterDescription
headersType: boolean/string[]. The headers will be auto detected from the first row or you can to provide headers array: 'h1name','h2name',....
delimiterAlternate delimiter. (Default: ',')
quoteAlternate quote. (Default: '"')
alwaysWriteHeadersSet to true if you always want headers written, even if no rows are written. (Default: false)
rowDelimiterSpecify an alternate row delimiter (i.e \r\n). (Default: '\n')
quoteHeadersIf true then all headers will be quoted. (Default: quoteColumns value)
quoteColumnsIf true then columns and headers will be quoted (unless quoteHeaders is specified). (Default: false).
escapeAlternate escaping value. (Default: '"')
includeEndRowDelimiterSet to true to include a row delimiter at the end of the csv. (Default: false)
writeBOMSet to true if you want the first character written to the stream to be a utf-8 BOM character. (Default: false)

More info here.