Skip to main content

Insert columns in Excel

Sophie avatar
Written by Sophie
Updated over a week ago

Definition and Usage

This command inserts blank columns beside a specified column in an Excel worksheet. You can choose to insert columns to the left or right of a target column and specify how many columns to insert.


Parameter Values

Input parameters

Parameter

Description

Possible Values

Required

Options / Notes

Excel instance

Please select an Excel instance to identify the instance to operate on

-

Yes

Must be created via the "Launch Excel" or "Get active Excel worksheet" command

Worksheet name

Specify the worksheet name

-

No

Leave blank for the active worksheet

Insert direction

Choose whether to insert columns to the left or right of the target column

To the left, To the right

Yes

-

Target column

Specify the column using either a number (1 = first, -1 = last) or a letter (e.g., A, B, C)

-

Yes

-

Number of columns

Specify the number of columns to be inserted

-

Yes

Must be a positive integer

Error handling

Parameter Name

Description

Throw error & stop

When an error occurs, the action will trigger an error and stop the execution of the entire app.

Retry command

If an error occurs, the action will retry the command in an attempt to resolve the issue and continue the process.

Ignore error & continue

When an error occurs, the action will be ignored, and the workflow will continue without interruption.

Variables produced

This action doesn't produce any variables.


Using Variables in Conditions

You can use variables in this command by inserting them into parameter fields where the {x} icon appears. For example, you might use a variable to dynamically determine the target column or the number of columns to insert. When using variables, ensure that they contain appropriate values for the parameter they're being used in - for example, using a numeric variable for the "Number of columns" parameter.


Notes

  • Before using this command, ensure that a valid Excel instance has been created and is active.

  • The target Excel file must be open and accessible.

  • When specifying the target column using a letter, it is not case-sensitive (e.g., 'a' and 'A' refer to the same column).

  • Using -1 as the target column value will reference the last column in the worksheet.

  • The inserted columns will take on the formatting of the adjacent columns.

  • This command will shift existing data to accommodate the new columns.

Did this answer your question?