Alteryx Designer Desktop Discussions

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

Copy Excel File and Move to Folder

tolson
5 - Atom

Hello all,

 

I am very new to Alteryx and have the following problem. I have several hundred excel files that are located in different folders.  They all have the same name except for the first word. Is there a way to copy those files and place them in one consolidated folder?

6 REPLIES 6
joelmiller66
9 - Comet

Hi @tolson - The process of 'copy/pasting' within your machine environment would be more of an RPA (Robotic Process Automation) process.

 

joelmiller66_0-1662752325157.png

 

In Alteryx if you want to read in files from folders the tool you would start with the Directory Tool found in the In/Out Category. This tool will return a list of files located in folders which you then can use Alteryx to read in those files.

 

Within the Directory Tool you have the ability to pinpoint the files you are trying to read in. It sounds like you will want to use the wildcard (*) at the beginning and then put the rest of the file name in the File Specification. And since you have multiple folders, you would also want to check the 'Include Subdirectories'.

joelmiller66_1-1662752412600.png

 

odonoghn
5 - Atom

You can get the filepath for each of the files using a Directory tool, assuming the files are generally going to be in the same area (and if they are all in subfolders of a specific folder you can flag the tool to include Subdirectories). Alteryx by default doesn't delete the files, so you would need some other way to get rid of the old files like a .bat file in a Run tool. Blob input and Blob Output tools will let you move the existing files, however, without changing them.

DavidSkaife
13 - Pulsar

Hi @tolson 

 

Moving files can be done using the Blob tools, please see attached sample workflow.

 

Use the directory tool to select the filepaths for all the files you want to move, using a wildcard (*) to replace the word in the filename that is different.

Using a formula tool, create a new field called 'Destination' and create the full path that you want the files moved to.

DavidSkaife_2-1662754445670.png

 

Setup your Blob Input and Output tools to replace the entire path with field and use the field that contains the original file/destination path as required

DavidSkaife_3-1662754540298.png

 

This should then move the files from one folder to another. As noted above this method will not delete files.

DavidSkaife_1-1662754245129.png

 

If you want to move files located in more than one location, you can add in multiple directory tools and union the FullPath together before creating the destination field

 

 

Felipe_Ribeir0
16 - Nebula

Hi @tolson . I buit two macros that i think that can solve part of your problems.

 

1-Move files from source to destination:

https://community.alteryx.com/t5/Public-Community-Gallery/Move-any-files-between-origin-and-destinat...

 

2-Copy folder from source to destination:

https://community.alteryx.com/t5/Public-Community-Gallery/COPY-DIRECTORIES-BETWEEN-SOURCE-AND-DESTIN...

 

The other part is to consolidate the data, this can be achieved using directory + dynamic input tools.

 

I hope that this is useful for you.

Alteryx_AR
12 - Quasar

@tolson 

@tolson 

To input multiple files, you can use directory and dynamic tool to grab data.

Alteryx_AR_0-1662861529923.png

 

 

At end use formula and output tool. Create the output file location + file name+ Sheet name in the formula tool.

 

Alteryx_AR_1-1662861529954.png

 

The top part of this configuration will not be used as at the bottom we are replacing the location by the output filename column. 

 

Alteryx_AR_2-1662861529998.png

 

Hope this helps

flying008
14 - Magnetar

Hi,@tolson 

 

You can try this macro in gallery.

flying008_0-1662942228435.png

 

Labels