Forum Discussion
How to split name of the file to store in another field in Document Library?
- Jul 28, 2022
pexperzen If you are using SharePoint online, you can use Power automate flow to update the column in library based on file name.
You can configure your flow something like this:
ID and Name in second action are dynamic data from first trigger in flow.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
It's difficult to answer without more context, so I'll make some assumptions.
1. You are looking for a SharePoint direct solution, not as part of PowerApps or Power Automate, or custom JavaScript.
2. The format of your filename is always the same. i.e., a 7 digit number, then a space, then text.
Using the assumptions above, you can use a calculated column with the following formula:
=LEFT([Name],7)
If the number of digits varies, but is always followed by a space, you can use
=LEFT([Name],FIND([NAME," ")-1)
Calculated columns are great, but can be limiting. If you need a more robust solution, Power Automate has lots of options that Calculated Columns do not.
Here are a couple of links to help you with Calculated Columns.
https://sharepoint-tools.github.io/formulas.html
Good luck,
Don Kirkham
Please click Mark as Best Response & Like if my post helped you to answer or resolve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
Thank you Don Kirkham for your kindly.
I do follow your suggestion but the output is 0. ( in filename_ma)
I have no idea what's my mistake. T^T
- Don KirkhamJul 27, 2022MVPI apologize. Further research reveals that the Name field is not available to use in a calculated column. Your only option is to use Power Automate. You have 2 options here:
1. Use Power Automate to populate the filename_ma column when a new document is added.
2. Use Power Automate to copy the filename into the Title column, then have filename_ma be a calculated column using Title (instead of Name)
Good luck!- ganeshsanapJul 28, 2022MVP
pexperzen If you are using SharePoint online, you can use Power automate flow to update the column in library based on file name.
You can configure your flow something like this:
ID and Name in second action are dynamic data from first trigger in flow.
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.