cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

How to get the last 16 characters of a file name saved to and insert it in an excel cell with using Flow

Hello All,

 

I am building a approval flow; once a file created in a specific sharepoint folder it triggers an approval flow. Briefly;

 

Trigger: A pdf file is saved to sharepoint folder (we have particular name format for the files uploaded, like vendorname_month_16digitdocnumber for example ABCCORP_02_GIS2020000012345)

1- an automated request goes to x person for registration of this document, 

     a) at this point flow creates a new row and gets the last 16 characters of the file name (GIS2020000012345) and inputs it in the column named "Document Number" in an excel sheet which is saved to a sharepoint folder.  

     b) next flow updates the row created in previous step>>a, and puts the date to the column named "Receiving Date" with the format "mm/dd/yyy"

      

21022020.png

 

Could you help me with this?

 

Thanks in advance!

 

Regards,

 

EmTu

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

 

I have solved it with 

1-Initialize variable >>>    triggerOutputs()?['body/{FilenameWithExtension}'] to Value field

2-Compose   >>> last(split(replace(variables('DocumentNumber'),'.pdf',''),'_')) to Inputs field.

 

09032020.png

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Hi @Emtu 

 

Use the expression below

 

last(split('filename','_'))

 

This will give GIS2020000012345

 

image.png

 

  



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted

@abm  thank you for your quick answer but it gives filename as an output.

I have tried last(split(triggerOutputs()?['body/{Identifier}'],'_')) but this time it gave an output with file extension like  GIS2020000012345.pdf

 

21022020.png

 
Highlighted
Super User III
Super User III

Hi,

 

You could another  split as with '.' (dot) as delimiter as use first expression to get the result.

 

first(split('filename",'.'))

 

Or if you have fixed length for the full string then you could use substring() expression without using two splits.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted

 

I have solved it with 

1-Initialize variable >>>    triggerOutputs()?['body/{FilenameWithExtension}'] to Value field

2-Compose   >>> last(split(replace(variables('DocumentNumber'),'.pdf',''),'_')) to Inputs field.

 

09032020.png

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (12,256)