Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Macro to convert XLSX to CSV

aamerin
7 - Meteor

I have 300 excel XLSX files that I need to get converted into CSV comma delimted files. I typically use a VBA script in excel, that goes to the folder where I have the files saved and goes through and creates a copy of the excel file as a CSV format. I would like to be able to do this in Alteryx.

 

Can someone help me figure out a batch macro that that do this?

 

Thanks!

 

 

14 REPLIES 14
JoBen
11 - Bolide

Hey @aamerin, try building a batch macro like this, and it should work. 

 

Help1.PNG

Help2.PNGHelp3.PNG

 

 

Thableaus
17 - Castor
17 - Castor

Hi @aamerin 

 

Here's an example of how you could do it.

 

You need to change the Directory Tool to the folder where your XLSX files are.

 

Cheers,

Jbrooks
7 - Meteor

Hi @aamerin,

 

Here is an example of how you could build it as an app where all you have to do is select the input and output folders.   You have to run it as an app, and not just a standard work flow.  Let me know if you have any questions.

aamerin
7 - Meteor

Can you send me a screen shot of your workflow? I have an older version of Alteryx and can't open your file

aamerin
7 - Meteor

@Jbrooks  Can you send me a screen shot of your workflow? I have an older version of Alteryx and can't open your file

Jbrooks
7 - Meteor

Accidentally posted twice use the one below

Jbrooks
7 - Meteor

Hi @aamerin,

 

Here are the screen shots, i have broken it out into three pieces:

 

The first is the actual app, which takes two inputs(The two folder browsers).  The First browser creates a list of all .xlsx files in the chosen directory, then second is the output directory and through the formula and append tools we create a final file path.  All that is fed into a batch macro.

xlsx to csv app.png

The batch macro controls three things, The first sets the file to get all the sheet names from an excel file and the second sets the file name in the dynamic input tool (i was having issues with sheets so that is why i switched to this method).  The third one is overriding the output file name to the final file name we built in the app step.


Xlsx to csv macro.png 

Here is a quick screen shot of the set up for the first two action boxes.  The third one is just set to the default update value.

 

Action 1 & 2.png

 

Hope this helps

aamerin
7 - Meteor

Thanks so much for your help. I'm getting stuck in the initial workflow. My action is giving me an error. Any idea why? Also, what did you have in your text file?

Jbrooks
7 - Meteor

I think its because you have nothing in the text input.  You can put whatever you want in there, it just has to be something because that's what the action is replacing.  See attached photos for more infotext config.pngAction config.png

Labels
Top Solution Authors