cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Australia
Helper V
Helper V

Use Power Automate AI to extract substring from irregular file names?

Hi fellow Power Automate veterans,

 

Not sure if Power Automate is the best tool for this but can I use Power Automate to extract substring from irregular file names?

For example:

My Document Library  (500+ files in total)

>

ABC-X1123.xls

ABC -2224.xls

G212 X 3333.xls

G212 X-3334.xls

...

 

where I would like to extract the 'X1234' bit from each file name (highlighted in red).

 

Many thanks,

1 ACCEPTED SOLUTION

Accepted Solutions
VJR
Impactful Individual
Impactful Individual

Hi @Australia 

 

If you are now going to work on PAD then you can close this thread. 

And if you felt any of my post assisted you towards implementing it, then you can mark it as a solution too while closing.

 

 

I have replied to your question about loops and files over there.

View solution in original post

7 REPLIES 7
VJR
Impactful Individual
Impactful Individual

Hello @Australia 

 

 

The 2nd file name does not contain an X whereas the 3rd file name does not have a hyphen.

But you would like to extract X1234 or red.

Is it going to be the case?

Is there at least some kind of a pattern to these file names?

 

 

ABC-X1123.xls

ABC -2224.xls

G212 X 3333.xls

G212 X-3334.xls

 






-------------------------------------------
Help fellow beings find relevant posts.
Upvote to a supporting response.
Mark as solution to an answer.

Hi @VJR ,

Many thanks for the reply.

You are correct, the desired substring is the 'X1234' bit from the file name. This is how I intend to use as the unique identifier when searching for a record in my intranet: Upload files to a website in a loop? - Power Platform Community (microsoft.com).

 

It was a mistake that my team did not think of a consistent file naming convention, everyone had his/her own way of naming a file.

ABC-X1123.xls  - this is the correct naming method

ABC -2224.xls  -  this should have been X2224

G212 X 3333.xls - this should have been X3333

G212 X-3334.xls - this should have been X3334

 

This would be the four main patterns I can see how my team members used. I am sorry for making this a challenging question.

VJR
Impactful Individual
Impactful Individual

Hello @Australia 

 

So that I suggest you with a solution using an appropriate tool, could you tell me the below.

This post is for Power Automate (Cloud Flows) but the other link you have posted is for Power Automate Desktop (Desktop Flows).

 

1. Are you trying to call a Desktop Flow from a Cloud Flow

or

2. Are you looking for a start to end solution using Desktop Flows (Power Automate Desktop) as per the other link.

 

If you need suggestion then Cloud Flow will help you in getting the attachments from Sharepoint because it has a Sharepoint Connector.

Whereas using Power Automate Desktop there is no direct way of downloading files from Sharpeoint without spying/screen scraping/web automation which will not always be reliable if something changes on the screen.

But for the web page that you showed, Desktop Flows (PAD) will be the perfect thing for it.

 

So option 1 will be more beneficial.

 

I did go through your other post and will help you on that.

 

 

Many thanks @VJR.

I have access to both Cloud Flow and Power Automate Desktop so I will take whichever solution you think easiest to accomplish this task.

In essence, the task is to

Upload attachments saved in a SharePoint Document Library to the intranet

 

With my limited knowledge I thought I had to first download all attachments from SP to My PC.

Then use PAD to upload these attachments like I were using iMacro.

 

Hope it clarifies.

 

 

VJR
Impactful Individual
Impactful Individual

Hi @Australia 

 

That makes it clear.

 

Regarding downloading attachments at first take a look at this

Power Automate – How to export attachments from SharePoint List Item. | Knowledge Share (spknowledge...

 

If that doesn't work for you I suggest you to search within the community pages if you get a solution to download attachments. I haven't worked on Sharepoint so cannot suggest the same.

 

If you dont find any suitable posts then I recommend opening a new post "How to download attachments from Sharepoint" because this page we are on right now is related to extracting strings. 

 

 

Once you are able to download the attachments to the folder then you can automate using PAD per my suggested steps in the other post.

 

--------------------------------------------------------------------------

ABC-X1123.xls  - this is the correct naming method

ABC -2224.xls  -  this should have been X2224

G212 X 3333.xls - this should have been X3333

G212 X-3334.xls - this should have been X3334

 

Regarding the file names there doesn't seem to be a unique pattern.

Check if is there anything inside those Excel files where you can open them via Cloud Flow, read the cell value and rename the file to the correct way it should be.






-------------------------------------------
Help fellow beings find relevant posts.
Upvote to a supporting response.
Mark as solution to an answer.

 

Thanks again @VJR .

Luckily all my attachments are stored in a Document Library already, which means that I can just click the Download button in SP to save all files to my PC as local copies.

Australia_0-1632636103823.png

I will now work on PAD, hopefully I can get it to work. I did go through all the videos that you provided. They are all very insightful guides so thanks very much for that. I just don't seem to see the Loop function, however, how does PAD know which file(s) to get for a particular record?

 

VJR
Impactful Individual
Impactful Individual

Hi @Australia 

 

If you are now going to work on PAD then you can close this thread. 

And if you felt any of my post assisted you towards implementing it, then you can mark it as a solution too while closing.

 

 

I have replied to your question about loops and files over there.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,611)