web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Delete every other col...
Power Automate
Answered

Delete every other column in Excel worksheet

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

As the title says, I am looking for a way to delete every other column in an excel worksheet.

 

Starting with column D, F, H, J...etc... and the final column to delete is CH. I assume a Loop would accomplish this, but I am not sure how to set it up.

 

Thank you!

I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Try this:

     

    1. 'Launch Excel' with your file

    2. 'Focus windows', class = XLMAIN

    3. 'Select cells in excel worksheet': select column 4, row 1 

    4. 'For 1 to x' (you have to adjust x here... to delete final column CH, x=42)

    5. 'Send keys' {LControlKey}({Space}) (Ctrl+Space to select all column)

    6. 'Send keys' {LControlKey}({OemMinus}) (Ctrl -, to delete column)

    7. 'Send keys' {Right} (to move 1 column to the right)

    8. End of loop

    Recording desktop will help find the correct keys in steps 5 to 7.

    Also, you can put all 'Send keys' together (i separated them just for explaining purposes)

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Would you be able to share a screenshot of what this would look like? I am a little confused by what you mean in #4 and #6.

     

    Thank you for your assistance! I appreciate you taking the time.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This wouldn't be so useful since I use a non-english version of PAD.

    4 is a 'Loop' action that starts from 1, end to 42 and increment by 1  

    6 is a 'Send Keys' action. In parameters, fill with {LControlKey}({OemMinus}), which is the equivalent of using Ctrl - as shortcut.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I should be able to figure out what actions you are using regardless of the language. The reason I am requesting a screenshot is because I am still learning how to use PAD so I am not entirely sure by what you mean.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    yasunm02_0-1628114472866.png

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you! This works perfectly. Screenshot for those who use PAD English below:

     

    gordo_c_123_0-1628116252859.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 238 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 225

#3
Haque Profile Picture

Haque 181

Last 30 days Overall leaderboard