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

Alteryx Designer Desktop Discussions

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

A tool that splits one file into many files

sasha_pugliese
7 - Meteor

You would be able to attach a file to the tool using the regular input but the tool you would just enter in the # of files you want and then it would split the file into that number. For Example if I had a file with 100 records and I wanted 5 files then it would split the file up into 5 files with 25 records each. It should also keep the header on each file.

6 REPLIES 6
DultonM
11 - Bolide

Hi @sasha_pugliese! Actually, this can already be done! Just follow these steps:

 

  1. Input your file with an Input Data tool.
  2. Drop in a Tile tool. Configure it with "Tile Method" = "Equal Records" and set "Number of Tiles" = the number of files you want.
  3. Drop in and configure an Output Data tool to a location/file name you want.
  4. In the Output Data tool check the "Take File/Table Name From Field" checkbox at the bottom. Leave the "Append Suffix to File/Table Name" option and select "Tile_Num" as the "Field Containing File Name or Part of File Name". I would uncheck "Keep Field in Output" so the Tile_Num column doesn't appear in your output.

 

You could get fancy with a Formula tool and create a new field that builds a unique file name based on Tile_Num so you aren't just appending a digit to the end of your file name.

 

A similar, alternative approach is described by @DanC in the Knowledge Base here. Hope this helps!

sasha_pugliese
7 - Meteor

Awesome!!! This just made our lives a lot easier! Thanks! I tried this and it worked perfectly!

Nilz
5 - Atom

 

@DultonM

What if I want to read a PDF file and split it ? because it's impossible to read a PDF file with input data item

imuhamed
5 - Atom

Thank you very much @DultonM

Joe_Lipski
13 - Pulsar
13 - Pulsar

Hi @Nilz PDFs can be read in using custom script, there are a quite a few opensource macros available on the gallery and posts on the community about this topic.

 

@KylieF - I think this idea needs to be re-classified or moved to the discussions as @DultonM provided a great solution to @sasha_pugliese's idea/question.

Joe Lipski
KylieF
Alteryx Community Team
Alteryx Community Team

Good call Joe! I've moved this post to Designer Discussions as the content is better suited for this board and so future users can have visibility into the solution provided by DultonM.

________________________________________________________
Program Manager - Community Platform, Alteryx
Labels