fix-excel-sheet-name

This package fixes MS-Excel sheet name by limiting it to 31 characters, empty sheet name, and removing illegal characters such as :\/?*[] and more.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
fix-excel-sheet-name
2.0.06 years ago6 years agoMinified + gzip package size for fix-excel-sheet-name in KB

Readme

Fix Excel Sheet Name
This package fixes MS-Excel sheet name by limiting it to 31 characters, empty sheet name, and removing illegal characters such as :\\/? and more.
!NPM versionnpm-imagenpm-url !Build Statustravis-imagetravis-url !Test Coveragecoveralls-imagecoveralls-url !Dependenciesdependencies-imagedependencies-url !DevDependenciesdependencies-dev-imagedependencies-dev-url !JavaScript Style Guidestandard-imagestandard-url

Installation (via npm)

$ npm install --save fix-excel-sheet-name

Usage

The package supports ES5 or later. The example below is using ES6 features.
const fixExcelSheetName = require('fix-excel-sheet-name')

const sheetName = 'Is it too long?? Excel/MS Excel sheets have some strange name limitations...'
fixExcelSheetName(sheetName, {
  empty: 'missing sheet name',
  omission: ' - END',
  replacement: '_'
}) // 'Is it too long__ Excel_MS - END'

  • sheetName (required) - the excel sheet name you want to fix.
  • empty (optional) - sheet name in case given name is missing (empty string). Default empty sheet name: "<empty>"
  • omission (optional) - MS Excel sheet names are limited to 31 characters. The last characters of the truncated sheet name are replaced with the omission string which defaults to “…”.
  • replacement (optional) - MS Excel sheet names cannot include some characters such as !: and more. The given parameter will be used to replace those illegal characters.

License

MIT

Author

Oron Nadiv (oron@nadiv.us)