Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including fix-excel-sheet-name with all npm packages installed. Try it out:

var fixExcelSheetName = require("fix-excel-sheet-name")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

fix-excel-sheet-name v2.0.0

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

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 version Build Status Test Coverage Dependencies DevDependencies JavaScript Style Guide

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)

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free