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

Renaming the File without Removing the Format created in the Excel

KamenRider
11 - Bolide

Hi guys,

 

I have a created a template with conditional formatting (color, letter style etc.) and run it using "run command". I was successful in combining my data with the template however I failed in renaming the file. When I rename it using the formula tool, it creates a separate file with no conditional formatting.

 

Can anyone help me how to rename my file without removing the conditional formatting? The format of the file is [Month Date] + "Filename" + [Datetimetoday]

 

Below are information of the workflow.

 

Two Template.PNG

Output.PNG

FilepPath.PNG

Looking forward for everyone's expertise on this.

 

Thanks,

Kamen

 

15 REPLIES 15
grazitti_sapna
17 - Castor

@KamenRider , Here is a link to a similar problem resolved before. Please look into it and let me know if it was helpful.

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/How-to-replace-an-existing-file-and-re...

Sapna Gupta
KamenRider
11 - Bolide

Hi @grazitti_sapna 

 

I think we have quite different case. A text input file containing the location and filename of the template is connected to the run command and I have another file containing the data to merge with the template. I am looking the workflow you have sent but I can't determine on how I can rename the filename. Will reg_replace help in renaming my file without removing my conditional formatting?

 

Please advised,

Kamen

Felipe_Ribeir0
16 - Nebula

Hi @KamenRider 

 

This macro is able to rename files without modifying anything of the file: https://community.alteryx.com/t5/Community-Gallery/Rename-files/ta-p/998942

 

 

INPUT of filepaths to be renamed (example):

FileCurrentNameFileNewName
Output.xlsxOutput_20220102.xlsx
SAPExtraction_16cefd9e6da78821d90d713c46f1d056.txtSAP_20220102.txt
Report_Qlik_Dashboard.pdfReport.pdf
DavidSkaife
13 - Pulsar

Hi @KamenRider 

 

Picking this up from our other thread, i think what your workflow is currently doing is this:

  1. create filename and run Run Command Tool
  2. create a new filename with additional parameters
  3. output to file, but as the file with that name doesn't exist it creates a new file

To correct this i think what you will need to do is move the Formula tool which creates the filename to earlier in the workflow, such as in the example below

 

DavidSkaife_0-1671625712971.png

 

This then keeps the filename/filepath consistant across both the Run Command tool and the Output tool.

 

 

KamenRider
11 - Bolide

HI @Felipe_Ribeir0  @DavidSkaife @grazitti_sapna 

 

I've checked the macro and I've encountered an error. Please be advised that I have three templates and thereby would be renaming the 3 files. for example

 

Singapore Report

Taiwan Report

Hawaii Report

 

rename to 

 

Month Date + Singapore Report + Date today

Month Date + Taiwan Report + Date today

Month Date + Hawaii Report + Date today

 

Note that I need to retain the conditional formatting. Just need to rename the filename.

 

Please see below errors I've encountered.

 

Rename failed.PNG

 Please advised.

 

Thanks,

Kamen

Felipe_Ribeir0
16 - Nebula

Hi @KamenRider 

 

Sorry, just looking at this print i was not able to know what is wrong. I tested it here and it is working fine.

Felipe_Ribeir0_0-1671627141321.png

 

See if your FileCurrentName and FileNewName (formula tool) are providing valid filepaths for all rows:

 

Felipe_Ribeir0_1-1671627234415.png

 

 

KamenRider
11 - Bolide

HI @DavidSkaife @Felipe_Ribeir0 @grazitti_sapna 

 

My current workflow doing in sequence.

 

1. I have created folder for my templates. The text input tool you see below consists of the input file of the template and the output filename. The "run command" copy the templates to the output folder.

 

Two Template.PNG

 2. Then I have an input file containing the raw file which do the processing to produce data to merge with the templates in the output file. The part of this process produce 3 excel files.

 

2 Workflows.PNG

 3. My problem is that when I used the formula tool to indicate change in filename, it creates a separate file with no conditional formatting together with the other 3 files with conditional formatting. So I produce 4 files instead of 3.

 

FilepPath.PNG

 

Output.PNG

Will try your advise @DavidSkaife . Will let you know if it is succes.

 

Thanks,

Kamen

 

 

 

KamenRider
11 - Bolide

Hi @Felipe_Ribeir0 

 

I not sure why it has error. Does your macro can rename multiples files regardless of how sheet tabs I have. Another questions is that, why is it being converted into zip file?

 

I do hope we can solutions to this.

 

Thanks,

Kamen

 

Felipe_Ribeir0
16 - Nebula

Hi @KamenRider 

 

The zip is just an example, the macro can rename any given file. See if you can run the attached example, that rename multiple xlsx files. If yes, try to understand how the formula is working to provide the FileNewName column, and then adapt it to your use case.

 

BEFORE RUNNING IT

Felipe_Ribeir0_0-1671629064469.png

 

AFTER RUNNING IT

Felipe_Ribeir0_1-1671629140517.png

 

Labels