Alteryx Designer Desktop Discussions

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

How to split an excel to multiple excels based on the Labeler number

Sunithaprdp
8 - Asteroid

Hi, 

 

How can we split an excel to multiple excel files based on a criteria.

This is the data in one excel worksheet. I want to split this excel to three excel workbooks based on the labeler. For eg: 00012 data should be in one excel , similarly 00023 and 00043 in different excel workbooks. How can we do that ? Can you please help me?

 

statelabeleramountyear
a0001210022022
b0001220022022
c0001230022022
d0001240022022
e0001250022022
f0002360022022
g0002370022022
h0002380022022
i0002390022022
j00023100022022
k00023110022022
l00043120022022
m00043130022022
n00043140022022
o00043150022022
17 REPLIES 17
binuacs
20 - Arcturus

@Sunithaprdp One way of doing this 

 

binuacs_0-1665523245188.png

 

Sunithaprdp
8 - Asteroid

Thanks for the solution, however the file consists of huge data more than 1000 lines so how can we modify this with Input tool. When I am trying for that I am not able to customize the Full Path formula. So how can we modify the formula. The actual excel workbook consists of various columns with different headers.

Looking forward to hearing from you.

 

Thanks and Regards,

Sunitha P

Sunithaprdp
8 - Asteroid

the file consists of huge data more than 1000 lines so how can we modify this with Input tool. When I am trying for that I am not able to customize the Full Path formula. So how can we modify the formula. The actual excel workbook consists of various columns with different headers.

Could someone please help me on this ask?

binuacs
20 - Arcturus

@Sunithaprdp When you say you are not able to customize the formula tool can you elaborate, please?

 

 

in the above example I'm writing all the output files into a temporary location that's why I gave '%temp%' + the field name you want to create the excel files with the name of the fields. Can you update your path in the place of '%temp%'. For example 

 

binuacs_0-1666001382436.png

 

 

please let me know if I'm not making any sense.

 

 

DataNath
17 - Castor

@Sunithaprdp if you don't want to go through the hassle of setting up the formula and output configuration yourself, you could try using the macro I created for exactly this purpose: https://community.alteryx.com/t5/Public-Community-Gallery/Output-to-multiple-Excel-files-or-sheets/t...

 

All you have to do is download it and then instead of an Output Data tool, at the end of your workflow, right click > insert > macro and then navigate to wherever you saved it.

 

DataNath_0-1666001776561.png

 

After that, the configuration is pretty straightforward, you would just pick your [Labeler] field as the one to split on. Of course I'm happy to answer any questions if you get stuck.

Sunithaprdp
8 - Asteroid

I am unable to add this macro as I am getting below error. Also wanted to confirm if this macro helps to segregate data based on the criteria as I mentioned?

 

Sunithaprdp_0-1666008981867.png

 

Sunithaprdp
8 - Asteroid

I am not sure if I understood it correctly. Sorry to ask you multiple questions as still I am taking baby steps on this tool.

 

Do we have to add a new column named Full Path? In my case already my input has got multiple columns of which I have to segregate based on the labeler and then divide this excel into three excel workbooks in order to get three inputs for my ultimate alteryx workflow.

 

Hope I could convey my concern. Thanks in advance.

 

Sunithaprdp_0-1666009157779.png

 

binuacs
20 - Arcturus

@Sunithaprdp Yes, you need to add a new column named full path and update the path where you need to save your excel output files.

DataNath
17 - Castor

@Sunithaprdp yes, the macro will split the data based on the [Labeler] field, as shown:

 

DataNath_0-1666010354267.pngDataNath_1-1666010421428.png

Labels