web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Extract file extension...
Power Automate
Answered

Extract file extension and add to updated file name

(0) ShareShare
ReportReport
Posted on by 52

Morning everyone, 

 

I have a very complicated (probably more than it should be) flow that collects information from a Microsoft form, including two date fields and two uploaded documents.  It sends the documents off for approval and if approved, updates a microsoft list row with an updated date and saves the files into Onedrive with a new file name.  

 

 If I leave in the ParseJSON Name expression it brings over the extension of the file but the original name as well, making the new file name very long and disorganized. I am trying to clean up the naming function of the file.  I want to be sure the extension is added to the name but the original file name is removed.  I would like to make sure the just the extension is added in the File Name section of the Create File step. 

 

How do I go about getting the content type extension added to this file name?  Please see the pics below of the current flow.

 

bmcnal_0-1701113308775.pngbmcnal_1-1701113335993.pngbmcnal_2-1701113359951.png

bmcnal_3-1701113577780.png

 

 

 

Categories:
I have the same question (0)
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @bmcnal ,

     

    You can use an expression to get the file extension only:

    split(item()?['name'], '.')[1]

     

    Best regards,

  • bmcnal Profile Picture
    52 on at

    I've tried your suggestion and get an error message.  I inserted the compose function as you have it written just under the Parse JSON but before the Apply to Each 4.  "'The template language function 'split' expects its first parameter to be of type string."  Looks like split needs a string input and it's not a string.  Thanks for your help. 

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @bmcnal ,

     

    This expression is used for replacing the extension directly in Create file action:

    vjefferni_2-1701223944617.png

     

    Best regards,

  • bmcnal Profile Picture
    52 on at
    Hello again @v-jefferni

    Just wanted to follow up on this fix.  Overall it works great, but occasionally people upload files that have multiple "." in the file name.  Resulting is error file creation. Is there a way to update the code below to only collect info after the last "." in the file name? 
    split(item()?['name'], '.')[1]
    Thanks for your time. 
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard