excel-worksheet-tools
Reactive icon

Excel Worksheet Tools

Stable version 1.0.1 (Compatible with OutSystems 11)
Uploaded
 on 25 Aug (3 weeks ago)
 by 
0.0
 (0 ratings)
excel-worksheet-tools

Excel Worksheet Tools

Documentation
1.0.1

Excel Worksheet Tools

Provides utility actions to modify worksheet properties and apply filters to an existing Excel workbook without recreating the workbook.

The extension works with Excel workbooks (.xlsx) represented as Binary Data and allows applications to customize worksheet appearance and behavior after the workbook has been generated.

Typical use cases include:

  • Highlighting worksheets with validation errors.

  • Hiding or showing worksheets.

  • Renaming worksheets.

  • Protecting and unprotecting worksheets.

  • Selecting the worksheet displayed when the workbook is opened.

  • Applying filters to worksheet data.

  • Filtering rows based on whether a specified column contains a value.

All actions modify the existing workbook and return the updated workbook as Binary Data.


SetWorksheetTabColor

Description

Sets the tab color of a worksheet in an existing Excel workbook.

If a valid HTML color value (for example, #FF0000) is provided, the worksheet tab is updated with the specified color.

If the Color parameter is empty or null, any existing custom tab color is removed and Excel's default tab color is restored.

This action modifies only the specified worksheet and returns the updated workbook.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
SheetNameInputName of the worksheet whose tab color should be updated.
ColorInputOptional HTML color (for example, #FF0000). Leave empty to restore the default tab color.
ExcelFileOutputUpdated Excel workbook.

SetWorksheetTabColorForMultipleSheets

Description

Updates the tab colors of multiple worksheets in a single operation.

Each record in the TabColors list specifies a worksheet name and an optional HTML color.

If a color is supplied, the worksheet tab is updated with that color.

If the color is empty, the worksheet's custom tab color is removed and Excel's default tab color is restored.

Using this action is more efficient than calling SetWorksheetTabColor repeatedly because the workbook is opened, modified, and saved only once.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
TabColorsInputRecord List containing worksheet names and corresponding tab colors.
ExcelFileOutputUpdated Excel workbook.

TabColors Structure

AttributeDescription
SheetNameName of the worksheet.
ColorOptional HTML color (for example, #00AAFF). Leave empty to restore the default tab color.

HideWorksheet

Description

Hides the specified worksheet.

The worksheet remains part of the workbook and all data is preserved, but it is not visible to users when the workbook is opened until it is made visible again.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
SheetNameInputName of the worksheet to hide.
ExcelFileOutputUpdated Excel workbook.

ShowWorksheet

Description

Makes a previously hidden worksheet visible.

If the worksheet is already visible, no changes are made.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
SheetNameInputName of the worksheet to show.
ExcelFileOutputUpdated Excel workbook.

RenameWorksheet

Description

Renames an existing worksheet.

The worksheet content, formatting, formulas, and position within the workbook remain unchanged. Only the worksheet name is updated.

If the specified worksheet cannot be found, no changes are made.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
OldSheetNameInputCurrent worksheet name.
NewSheetNameInputNew worksheet name.
ExcelFileOutputUpdated Excel workbook.

ProtectWorksheet

Description

Protects the specified worksheet against editing.

An optional password may be provided. If a password is supplied, users must enter the password to remove worksheet protection in Microsoft Excel.

This action protects the worksheet only. It does not encrypt the workbook or protect workbook structure.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
SheetNameInputName of the worksheet to protect.
PasswordInputOptional password used to protect the worksheet.
ExcelFileOutputUpdated Excel workbook.

UnprotectWorksheet

Description

Removes protection from the specified worksheet.

If the worksheet is not protected, no changes are made.

This action affects worksheet protection only and does not modify workbook-level protection.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
SheetNameInputName of the worksheet to unprotect.
ExcelFileOutputUpdated Excel workbook.

SetActiveWorksheet

Description

Sets the specified worksheet as the active worksheet.

When the workbook is opened in Microsoft Excel, this worksheet is selected and displayed first.

This action changes only the initial worksheet displayed to the user. It does not modify worksheet content or workbook structure.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
SheetNameInputName of the worksheet to activate.
ExcelFileOutputUpdated Excel workbook.

ApplyExcelFilters

Description

Applies filters to one or more worksheets in an existing Excel workbook.

The action uses the worksheet header row to identify the column specified in each filter definition and applies the requested filter to that column.

Currently, the action supports the NotBlank filter type.

When a NotBlank filter is applied, rows where the specified column is blank are excluded from the filtered result. The Excel AutoFilter state is also updated so that the Blanks option is unselected for the filtered column.

This action is useful when an Excel workbook has already been generated and specific rows need to be filtered based on the presence of values in a particular column.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
FiltersInputRecord List containing the filter definitions to apply.
HeaderRowInputRow number containing the worksheet column headers.
ExcelFileOutputUpdated Excel workbook.

Filters Structure

Each record in the Filters list defines a filter to apply to a worksheet.

AttributeDescription
SheetNameOptional name of the worksheet on which the filter should be applied.
ColumnNameName of the worksheet column header to filter.
FilterTypeType of filter to apply. Currently supports NotBlank.
FilterValueOptional filter value. Currently not used for NotBlank.

Example

SheetName  : Employee Data
ColumnName : Department
FilterType : NotBlank
FilterValue:

This applies a NotBlank filter to the Department column on the Employee Data worksheet.


NotBlank Filter

The NotBlank filter excludes rows where the specified column contains a blank value.

Before Filtering

Employee    Department    Status
John        IT            Active
Mary                      Active
Peter       HR            Inactive
David                     Active

After Filtering

Employee    Department    Status
John        IT            Active
Peter       HR            Inactive

Rows where Department is blank are hidden.

When the workbook is opened in Excel, the filter state also indicates that Blanks are not selected for the filtered column.


Multiple Filters

Multiple filter definitions can be supplied in a single operation.

For example:

SheetName  : Employee Data
ColumnName : Department
FilterType : NotBlank

and:

SheetName  : Employee Data
ColumnName : Status
FilterType : NotBlank

will result in both conditions being applied.

Only rows where both Department and Status contain values will remain visible.


Worksheet Selection

The SheetName attribute determines which worksheet receives the filter.

Worksheet names are matched without regard to case.

For example:

SheetName = Employee Data

will target the worksheet named Employee Data.

If SheetName is empty or null, the filter is considered applicable to all worksheets.


Column Selection

The ColumnName attribute is matched against the worksheet header row specified by HeaderRow.

For example, if:

HeaderRow = 1

and the worksheet contains:

A             B             C
Employee      Department    Status

then:

ColumnName = Department

will apply the filter to column B.

Column matching is case-insensitive and ignores leading and trailing whitespace.


AutoFilter Behavior

The action creates an Excel AutoFilter over the worksheet's used data range.

Excel's standard AutoFilter behavior displays filter dropdowns across the AutoFilter range.

Therefore, applying a filter to a single column does not necessarily mean that filter dropdowns will be displayed only on that column.

For example:

Employee ▼    Department ▼    Status ▼
                         ↑
                    NotBlank

The active filter criterion is applied to the requested column, while the other columns may still display their standard Excel filter dropdowns.


Row Visibility

For a NotBlank filter, rows containing blank values in the target column are explicitly hidden in the generated workbook.

This ensures that the filtered result is visible immediately when the workbook is opened, rather than relying only on Excel to execute the filter after opening the file.


Supported Filter Types

The current version supports:

Filter TypeSupported
NotBlankYes

The following filter types are not currently supported:

  • Blank

  • Equals

  • NotEquals

  • Contains

  • NotContains

  • StartsWith

  • EndsWith

  • GreaterThan

  • LessThan

  • GreaterThanOrEqual

  • LessThanOrEqual

Unsupported filter types will result in an error.


Validation

The action validates the supplied input before applying the filter.

The following conditions are validated:

  • The Excel file must not be empty.

  • The HeaderRow must be greater than zero.

  • The specified filter column must exist in the worksheet.

  • The filter type must be supported.

If a specified column cannot be found, the action returns an error indicating the column and worksheet where the lookup failed.


Example Use Case

A workbook contains employee information and includes rows where the Department field has not yet been populated.

The application can use:

HeaderRow  : 1

SheetName  : Employees
ColumnName : Department
FilterType : NotBlank

The resulting workbook will display only employees with a populated Department value.

This can be useful for:

  • Data validation.

  • Reviewing completed records.

  • Identifying incomplete records.

  • Preparing filtered reports.

  • Removing incomplete rows from the initial visible result.


Notes

  • All actions expect a valid .xlsx workbook as Binary Data.

  • If the specified worksheet does not exist, the workbook is returned unchanged where applicable.

  • These actions preserve workbook data, formatting, formulas, and worksheets except for the requested modification.

  • ApplyExcelFilters modifies the worksheet's AutoFilter state and row visibility when applying filters.

  • The extension is intended to be used after generating an Excel workbook, such as with the Advanced Excel component or other workbook-generation libraries.

  • The current filter implementation supports NotBlank only.

  • Applying a filter does not delete filtered rows; rows are hidden and remain part of the workbook.

  • The component is intended for existing .xlsx workbooks and does not recreate the workbook during the requested worksheet modification.


1.0.0

Excel Worksheet Tools

Provides utility actions to modify worksheet properties in an existing Excel workbook without recreating the workbook. The extension works with Excel workbooks (.xlsx) represented as Binary Data and allows applications to customize worksheet appearance and behavior after the workbook has been generated.

Typical use cases include highlighting worksheets with validation errors, hiding or showing worksheets, renaming worksheets, protecting worksheets, and selecting the worksheet that is displayed when the workbook is opened.

  • SetWorksheetTabColor

Description

Sets the tab color of a worksheet in an existing Excel workbook.

If a valid HTML color value (for example, #FF0000) is provided, the worksheet tab is updated with the specified color.

If the Color parameter is empty or null, any existing custom tab color is removed and Excel's default tab color is restored.

This action modifies only the specified worksheet and returns the updated workbook.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
SheetNameInputName of the worksheet whose tab color should be updated.
ColorInputOptional HTML color (for example #FF0000). Leave empty to restore the default tab color.
ExcelFileOutputUpdated Excel workbook.

  • SetWorksheetTabColorForMultipleSheets

Description

Updates the tab colors of multiple worksheets in a single operation.

Each record in the TabColors list specifies a worksheet name and an optional HTML color.

If a color is supplied, the worksheet tab is updated with that color.

If the color is empty, the worksheet's custom tab color is removed and Excel's default tab color is restored.

Using this action is more efficient than calling SetWorksheetTabColor repeatedly because the workbook is opened, modified, and saved only once.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
TabColorsInputRecord List containing worksheet names and corresponding tab colors.
ExcelFileOutputUpdated Excel workbook.

TabColors Structure

AttributeDescription
SheetNameName of the worksheet.
ColorOptional HTML color (for example #00AAFF). Leave empty to restore the default tab color.

  • HideWorksheet

Description

Hides the specified worksheet.

The worksheet remains part of the workbook and all data is preserved, but it is not visible to users when the workbook is opened until it is made visible again.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
SheetNameInputName of the worksheet to hide.
ExcelFileOutputUpdated Excel workbook.

  • ShowWorksheet

Description

Makes a previously hidden worksheet visible.

If the worksheet is already visible, no changes are made.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
SheetNameInputName of the worksheet to show.
ExcelFileOutputUpdated Excel workbook.

  • RenameWorksheet

Description

Renames an existing worksheet.

The worksheet content, formatting, formulas, and position within the workbook remain unchanged. Only the worksheet name is updated.

If the specified worksheet cannot be found, no changes are made.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
OldSheetNameInputCurrent worksheet name.
NewSheetNameInputNew worksheet name.
ExcelFileOutputUpdated Excel workbook.

  • ProtectWorksheet

Description

Protects the specified worksheet against editing.

An optional password may be provided. If a password is supplied, users must enter the password to remove worksheet protection in Microsoft Excel.

This action protects the worksheet only. It does not encrypt the workbook or protect workbook structure.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
SheetNameInputName of the worksheet to protect.
PasswordInputOptional password used to protect the worksheet.
ExcelFileOutputUpdated Excel workbook.

  • UnprotectWorksheet

Description

Removes protection from the specified worksheet.

If the worksheet is not protected, no changes are made.

This action affects worksheet protection only and does not modify workbook-level protection.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
SheetNameInputName of the worksheet to unprotect.
ExcelFileOutputUpdated Excel workbook.

  • SetActiveWorksheet

Description

Sets the specified worksheet as the active worksheet.

When the workbook is opened in Microsoft Excel, this worksheet is selected and displayed first.

This action changes only the initial worksheet displayed to the user. It does not modify worksheet content or workbook structure.

Parameters

ParameterDirectionDescription
ExcelFileInputExcel workbook as Binary Data.
SheetNameInputName of the worksheet to activate.
ExcelFileOutputUpdated Excel workbook.


Notes

You may also want to include these notes in your documentation:

  • All actions expect a valid .xlsx workbook as Binary Data.

  • If the specified worksheet does not exist, the workbook is returned unchanged.

  • These actions preserve all workbook data, formatting, formulas, and worksheets except for the requested modification.

  • The extension is intended to be used after generating an Excel workbook, such as with the Advanced Excel component or other workbook-generation libraries.