Alteryx Designer Desktop Discussions

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

How to rename a template in excel after copying and inserting the data

Nithinpanicker
8 - Asteroid

I have a template in excel file. I have designed a workflow to copy the template file from a folder to output folder in order to preserve the template using a batch command and then inserted all the data that I require into the template. But I would like the template to be renamed after the data has been inserted with the date the workflow has been run. For example: Output_yyyy-mm-dd.

 

Any help will be appreciated.

16 REPLIES 16
Qiu
21 - Polaris
21 - Polaris

@Nithinpanicker 
Can you just rename the file during the copy process?😁

DataNath
17 - Castor

Hey @Nithinpanicker, once you know where you'll be saving the file, you can use the Formula tool to create a custom filepath with today's date added as so:

 

DataNath_0-1655188474532.png

 

In your Output Data tool, you can then bring in this full path to use as your save location, by selecting the following:

 

Custom filepath.png

 

When you then run your flow, you'll get the following:

 

DataNath_1-1655188625253.png

 

I have attached my dummy workflow. Hope this helps but let us know if not so we can assist you further!

 

grazitti_sapna
17 - Castor

Hi @Nithinpanicker , you can try this.

 

grazitti_sapna_0-1655188687912.pnggrazitti_sapna_1-1655188696888.png

I hope this helps!

 

Thanks!

Sapna Gupta
Nithinpanicker
8 - Asteroid

Hi @Qiu,

 

I have tried this with success, but when I need to merge my data to the template, I do not know how to configure alteryx to output to the file with today's date. 

Nithinpanicker
8 - Asteroid

Attaching a screenshot of my current workflow. The top workflow copies the template to the output directory. The middle, merges data into the template and the bottom finally renames the output file.

The issue I currently have while running this workflow is that, when I run this the first time, the top and middle workflows run fine and the rename command gives me an error i.e, it copies the template and pastes it in my output folder and inserts the data into the file. But the filename renames unchanged.

 

On a rerun of the workflow again without doing anything else, it renames the file. 

 

I do not understand why I have to run this workflow twice to get the filename renamed.

 

Thanks for your help. 

DataNath
17 - Castor

Hey @Nithinpanicker if I'm looking over this correctly, I don't think you actually need the bottom stream for renaming your file. You could just do this in the middle stream by using the methods outlined below and simply appending the date to the filename. There won't be any risk of overwriting the template as the final output file name will be unique to today's date.

Nithinpanicker
8 - Asteroid

Hi @DataNath,

 

Thank you for your response.

 

Could you please tell me what I need to do append the date to the filename. When I try appending the date, it only renames the sheet name and not the file name itself.

 

Thanks

DataNath
17 - Castor

No problem @Nithinpanicker.

 

See my solution above with the dummy workflow attached. All you'll want to change in your case when creating the custom filepath is swapping out where my directory/path is for your own. I just used 'Output_' as well so you may want to change that. When it comes to the Output Data tool, make sure you change the entire filepath, using this newly created filepath - the configuration is shown above in my screenshot!

Nithinpanicker
8 - Asteroid

Hi @DataNath,

 

I tried doing this, but now it does not seem to be writing to the template anymore. The top stream copies the template. The middle stream just renames the excel data now

 

 

Labels