fix-excel-sheet-name
v2.0.0
Published
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
93
Maintainers
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.
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.