cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
leofromrio
Level: Powered On

Change attachment name replacing words and formatting date

Hi!
I need to save an email attachment to an onedrive folder, but first I need to change the name of the attachment as shown below.
Attachment original name: "PET - 26-11-19.xls"
1 - I need to replace the "PET" with "BRA".
2 - I need to remove spaces and dashes.
3 - I need to get the date portion "26-11-19" and convert it to "20191126".
So the name of the saved file would be: "BRA20191126.xls"
Is it possible?
Thanks!
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Change attachment name replacing words and formatting date

Hi @leofromrio,

 

You could follow these steps to process the string of Filename:

 

Step 1: Replace the "PET" with "BRA", then remove spaces and dashes:

replace(replace(replace(outputs('Compose'),'PET','BRA'),' ',''),'-','')

Step 2: Adjust date order, process and regroup by using substring() function and concat() function:

concat(substring(variables('Temp'),0,3),'20',substring(variables('Temp'),7,2),substring(variables('Temp'),5,2),substring(variables('Temp'),3,2),substring(variables('Temp'),9,4))

Annotation 2019-11-27 141252.png

Result:

Annotation 2019-11-27 141901.png

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: Change attachment name replacing words and formatting date

Hi @leofromrio,

 

You could follow these steps to process the string of Filename:

 

Step 1: Replace the "PET" with "BRA", then remove spaces and dashes:

replace(replace(replace(outputs('Compose'),'PET','BRA'),' ',''),'-','')

Step 2: Adjust date order, process and regroup by using substring() function and concat() function:

concat(substring(variables('Temp'),0,3),'20',substring(variables('Temp'),7,2),substring(variables('Temp'),5,2),substring(variables('Temp'),3,2),substring(variables('Temp'),9,4))

Annotation 2019-11-27 141252.png

Result:

Annotation 2019-11-27 141901.png

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (4,750)