Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Read files from a directory

amrutkasyap
7 - Meteor

Hello,

 

There are about 25 excel files in a directory, each of them have same column names for the first 20 columns. After that some of them have extra columns and its random. How do i remove these extra columns so that all these files have the same structure  

 

For e.g.

 

File 1

Col 1Col 2Col 3Col 4Col 5Extra Col 1

 

File 2

Col 1Col 2Col 3Col 4Col 5Extra Col 1Extra Col 2

 

So from File 1 extra Col 1 needs to be removed

from File 2 extra Col 1 and 2 needs to be removed.

 

Any help is much appreciated 

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @amrutkasyap 

 

Read all the files and columns using the below macro and later deselect the not-required columns in select tool.

 

atcodedog05_0-1646841530039.png

 

Reference post : https://community.alteryx.com/t5/Alteryx-Knowledge-Base/The-Ultimate-Input-Data-Flowchart/ta-p/20480 

 

Hope this helps : )

 

binuacs
21 - Polaris

@amrutkasyap one option combine all files using a batch macro and remove the unwanted fields using select tool

 

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/The-Ultimate-Input-Data-Flowchart/t...

atcodedog05
22 - Nova
22 - Nova

Hi @amrutkasyap 

 

Glad to hear😀. All of them uses the same method 🙂 you can check through.

 

Happy to help : )

Cheers and have a nice day!

Labels
Top Solution Authors