Wednesday, August 17, 2011

How is Sheet Name handled in Excel?

While fixing bugs of SheetNameFormatter class, I found some rules of handling the sheet names in Excel.

Rules are as followes:

a. If there are spaces among the letters of the sheet name, single quotes will be added.

my sheet!A1 => ‘my sheet’!A1

b. If the sheet name starts with a digit instead of letter, single quotes should be added.

3rdTimeLucky!A1 => ‘3rdTimeLucky’!A1

c. If single quotes exists in the sheet name, single quotes should be added on both sides and the single quote in the middle should be replaced with two single quotes.

0’Hero!A1 => ‘0’’Hero’!A1

d. If the sheet name looks like cell reference like A1, B2, CC5, it should be braced with single quotes.

A12000!A1 => ‘A12000’!A1

e. If there are underscores in the sheet name, it’s NOT necessary to put single quotes at both sides.

my_sheet!A1 => my_sheet!A1

No comments:

Post a Comment