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.

Renaming PDFs based on columns in Excel

JamesJL
7 - Meteor

Hello!

 

I'm wondering if there is a way to have Alteryx rename pdf files based on certain columns in Excel. For example:

 

Excel: Column A: Name + Column B: Address + Column C: City

 

PDF file name: Formally was called 'Name', Now I want it as Name - Address - City

 

I would start with the input file & Directory -> formula tool (possibly Column A + " - " + Column B + " - " + Column C?) and the output is a command tool correct? I can't seem to remember how to do this.

 

Many thanks!

6 REPLIES 6
BS_THE_ANALYST
15 - Aurora
15 - Aurora

@JamesJL You could definitely bring those files into the workflow then leverage the columns to write out to a new PDF with desired column names involved. I'm not sure about renaming an existing PDF though, but I imagine this can be done leveraging the Python tool in Alteryx

All the best,
BS

LinkedIN

Bulien
alexnajm
18 - Pollux
18 - Pollux

You could use the Blob Input and Blob Output tool to rename PDFs! There would just have to be a way to map the data to the PDFs so the renaming can be done. 

JamesJL
7 - Meteor

Thank you @BS_THE_ANALYST I'll look into the Python Tool.

 

@alexnajm I just remembered I posted something similar to this a while ago. I'm going to refer to what you said then too!

BS_THE_ANALYST
15 - Aurora
15 - Aurora

I haven't used Blob input and output tools so I'll definitely look into them; thanks for the suggestion @alexnajm!

If the Blob tools don't get the job done, I'd use ChatbotGpt and write out what you want executed in a Python script format. It should be able to put that together. Then just drag Python tool on the canvas and insert the script into the Jupyter Notebook.

All the best,
BS

LinkedIN

Bulien
danilang
19 - Altair
19 - Altair

Hi @JamesJL 

 

Going Waaay back into the DOS days, what you're looking for is a batch file that can rename a series of files.  The syntax for this is 

 

ren oldname.pdf newname.pdf

 

 

Once you have you new names defined possibly in field called [NewName], use a second formula tool to build up each ren line

 

'ren "'+[name]+'".pdf "'+[NewName]+'".pdf'

 

giving you

ren "Mary Smith.pdf" "Mary Smith - 123 Main St - SomeTown.pdf"

 

Concatenate all these line together using a Summarize and \n as the delimiter.  Prefix this with a line to change to your working directory

 

cd "c:\temp\working directory"

 

 

Giving you a final DOS batch file that looks like this 

 

 

cd "c:\temp\working directory"
ren "Mary Smith.pdf" "Mary Smith - 123 Main St - SomeTown.pdf"
ren "John Jones.pdf" "John Jones - 123 Main St - SomeOtherTown.pdf"

 

 

Pass this file to the command tool and you're renames will be done.

 

Of course the methods mentioned by @BS_THE_ANALYST and @alexnajm will both work as well.  The one problem with the Blob tool approach is that it doesn't actually rename the file, but creates a copy leaving the only one behind.  This may be or may not acceptable. 

 

Dan

 

Luke_C
17 - Castor
17 - Castor

Hi @JamesJL 

 

You can reference the solution to the below post as a starting point. It uses the run command tool similar to what @danilang outlined.

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Rename-300-PDF-files-within-Directory/...

Labels
Top Solution Authors