Showing results for 
Search instead for 
Did you mean: 
New Member

Filename data to library column



I would like to fill in column data from informations in the file name of documents.


We right now have a Flow that saves PDF attachements from mails into document librarys, the names of the files are for example:


filename: 93483_test_blabla_2736212.pdf


The library has the following columns:


Filename l Info 1 l Info 2 l Info 3


Now I want the flow to not simply save the file but also fill in the information from the filename for example:


Filename l Info 1 l Info 2 l Info 3

934483    l test    l blablal 2736212


Is there any way to do that with a flow?


Thanks in advance

Niklas Döring

Community Support
Community Support

Hi @Landlinie,


I assume that all the coming emails have the same format of subject. If yes, then you could take the following codes for a reference.


The flow is triggered by When an email arrives.


Then using Compose actions to get value for each column.


Add Compose action, using the following code to have each character separated by a “_”



Add Compose2, use the following code to return the filename:



Add Compose3, use the following code to return info1:



Add Compose4, use the following code to return info2:



Add Compose5, use the following code to return info3. Because the info3 in the example is of type array, while string is needed in the code, so I use function string to format it as a string.



Please take the following screenshot for a reference.



More details about WDL, please check it at here:



Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Community Champion
Community Champion

Hello, @Landlinie!

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @v-yamao-msft‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!

Thank you for being an active member of the Flow Community!

Flow Community Manager

- Gabriel
Community Manager
Power Automate | Power Virtual Agents
Super User Program Manager



first of all thanks for the fast and in detail answer!


I wasn't in the office for a couple of days so I just read it today.


I have to say im completely new to flow and never even heard of compose before the post so I might sound a bit stupid, please forgive me for that. The link is sadly not working anymore it seems:


Right now the subject is random, only the filename has the right variables, but I think I could change that, if its not possible to grab the information from the file name.


To give you a better view heres a Screenshot of the Flow right now:




There are alot of Flows for different Documents, all have the same steps just different origin and destination.


A new mail gets send to the mail adress and either gets sorted through the subject or an mail alias to a Folder, each flow checks a different folder, grabs the attachment and drops it in a document library on Sharepoint (each folder has a different library).


Each folder then has different colums in the document library, for example customer Number and invoice number. Our scanner has the ability to scan for Barcodes or OCR so we get the Information into the file name. Right now these columns then get filled out manually which is alot of work, we want to fill them out automatically with flow.


It seems like the compose feature would be able to grab the data from the filename or subject, but I'm not quite sure how I get the data to the colums afterwards, could you help me with that?


Thanks in advance


Anyone else got an idea? or is it not possible with flow?

Still looking, someone got an Idea?

Helpful resources

2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,717)