excel validate sheet name

Prev Next

Function Names

excel validate sheet name

Description

This function checks if the sheet name proposed can be used in Microsoft Excel. The sheet name must not contain at least 1 character and not more than 31 characters, and the following characters must not be used: * / ? [ ] : \

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

1

Parameters

No.TypeDescription
1
input
string Proposed sheet name

This sheet name will be checked

Return value

TypeDescription
boolean Check OK

true is returned if the proposed sheet name is OK for Excel.

Examples

       good examples[] = { "Table 1", "T.1", "It contains 31 Characters .....", "1", "Section §1 - About Cafés" };
       bad  examples[] = { "", "a/b", "Section 1:1", "It contains 32 Characters ......", Two + new line + lines };

       for all( good examples[], st[] ) print( excel validate sheet name( st[] ), "  " );
       echo;

       for all( bad examples[], st[] )  print( excel validate sheet name( st[] ), " " );
       echo;

Output

true  true  true  true  true  
false false false false false
Try it yourself: Open LIB_Function_excel_validate_sheet_name.b4p in B4P_Examples.zip. Decompress before use.