- By default, Power Automate Desktop is only able to delete one Excel column at a time.
- Below is a Subflow to delete multiple consecutive or non-consecutive columns all at the same time, either by using
column alphabets or index numbers or both.
- No loops used to iterate through the Excel columns
- Developer can pass just the columns s/he wants to delete
- Deletes all specified columns in a single shot and not one by one
- Step by step explanation along with the Desktop flow attached below
- Developer can pass the columns either as alphabets
Eg; A:A,C:C,H:H,K:O,Q:U
- or Column numbers
Eg; 1, 3, 8, 11:15, 17:21
- with and without colon both in the same pass
Eg; 1:1, 3, 8, 11:15, 17:21
- or mix of alphabets, numbers, single range, multiple ranges
1:1, 3, D, F:G, 11:15, 17:21
- Can pass as variables too
%var1%:%var2%,%var3%
Notice the comma and colon
i) Assuming the input file to be as follows and we would like to delete consecutive and non-consecutive columns all in the same pass.

ii) Follow the numbering

1: Set the full path of the Excel file from which to delete the columns
2: Set the columns you would like to delete
Examples given in the Comments section of Line #5 of the code OR at the top of this post.
I have given a combination of column index, range of alphabets, single alphabet, non-consecutive columns (Refer yellow highlighted)
3: Pass the name of the Worksheet from which you want to delete the columns
You can add your own validation to check if the sheet exists.
iii) Follow the numbering

You don't need to do anything in the below steps. They are just for explanation.
4: The sheet that you want the columns to be deleted will be activated if its not already.
This is an optional action. You can delete it if not required.
5: This step will call a Subflow which has a vbscript written to delete the passed columns.
You will be able to see the code in the vbscript when you download the desktop flow attached to this page.
6: Saves the Excel before closing.
You can perform any of the other Excel operations before or after deleting the columns without closing and re-opening the file.
iv) Input and final output after running the Flow


- How to do the same for Rows is given in the post here
Delete multiple consecutive and non-consecutive Ex... - Power Platform Community (microsoft.com)
- Also contains instructions on how to copy-paste the attached desktop flow files into Power Automate Desktop.
v) Refer the comments in the Flow, make changes to parameters and Run the Main flow.
Make sure to run it against a copy of your Excel at first and not an original Excel file.