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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Splitting a file path ...
Power Automate
Unanswered

Splitting a file path and recalling parts with a flow

(0) ShareShare
ReportReport
Posted on by 4

I have created a flow that updates a table in excel anytime a document is uploaded to sharepoint. 

 

I use the split function to separate the file path like the example here: 

https://powerusers.microsoft.com/t5/Building-Flows/Using-Split-Function-for-Folder-Path/td-p/366527

 

I am having one issue with it though. In my case, the file path may be different from time to time. Using the above example let's say the file path is: 

Job Site Name/District/Vendor Name/Service Reports/PO 12345 Service Report.pdf

Or it may be:

Job Site Name/District/Vendor Name/Service Reports/Location/PO 12345 Service Report.pdf

 

And I want to recall the "Vendor name" and the "District" to update my excel table.

Using these formulas

last(take(outputs('Compose'),sub(length(outputs('Compose')),2)))
last(take(outputs('Compose'),sub(length(outputs('Compose')),3)))

I can recall the "Vendor name" and "District", but since it starts from the end of the file path and moves backwards, in the second file path it would return the "Service Reports" and "Vendor Name".

 

My question is this. Since the information I need is always in the same location starting at the left of the file path instead of the right, is there anyway to do that instead of starting at the end and moving backwards?

 

Thank you for your help!

Categories:
I have the same question (0)
  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hey @Frasier433 

     

    I would use split and then call the objects of an array using an integer.

     

    DamoBird365_0-1620656365835.png

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

  • Frasier433 Profile Picture
    4 on at

    That worked well. Thank you!

     

    A couple of questions for learning purposes.

    What is the "" at the end of the array for?

    Does recalling with a integer start at 0 being the first item in the array and so on?

    Flow 1.JPG

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at

    Hi @Frasier433 

     

    Pleased that it worked and glad to help you with your understanding as follows:

     

    What is the "" at the end of the array for?

    You are splitting the string by / and as the end of the string is /, it creates an empty value in the array "". Had the path ended /lastfolder, the last value in the array would be "lastfolder".

     

    Does recalling with a integer start at 0 being the first item in the array and so on?

    Absolutely correct.  Start at 0 and up you go.  

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard