SOLVED

Working with the file name

Copper Contributor

Hi,

 

I am fairly new to Sharepoint and also working with a German version, so please excuse and correct any wrong terminology. I will put an * behind any term I translated myself.

 

On SP2016, I have an image library* and have added a column* of the type "Calculate"*. I am looking for a formula that gives me the filename "AnyImage.gif", just as =[AnyColumnName] would give me what is in that column. I was hoping naively that =[NAME] would do that, but it produces an error.

 

Can someone help me in this particular case, or direct me to a guide how to access the "special columns" of a list* in general?

 

Thanks in advance,

         Nils.

8 Replies
best response confirmed by NilsRichter (Copper Contributor)
Solution

@NilsRichter 

It's a known limitation of SharePoint. We cannot use file name in calculated column formula.

There is a SharePoint UserVoice for this. You can vote here: Use filename in calculated field

Workaround:

  1. Create a new text field & populate its value using workflow on item creation/update. Hide this field from property forms.

  2. Use workflow to updated the Title field based on the filename. Then use Title field in the calculated column formula.


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.

Hi, I am also pretty new to share point and I have the same problem. I need to use the name of the file in a formula. Can you explain further how to do those workflows you mentioned, please?

@LesCast11 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:

ganeshsanap_0-1658991714676.png

ID and Name in second action are dynamic data from first trigger in flow.


Please consider giving a Like if my post helped you in any way.

Many thanks! This really help me!!

@ganeshsanap 

 

Hi ganeshsanap, I've setup the workflow and got the filename to appear as Title for the document (see prints below). But, how to use Title field in the calculated column formula? I need to get this info in a specified cell inside the excel-doc. Could you please post some info on how to do this? 

Many thanks,

Johan

 

Johan320_0-1671180396775.png

Johan320_1-1671180582725.png

 

 

@Johan320 You cannot get SharePoint column information in cells inside excel file using SharePoint calculated columns. This is not possible using calculated column formula.


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.

@ganeshsanap I get a warning about creating an infinite loop (because updating Title will trigger the action again).  What is the best way to avoid this?  Ideally, the action should not trigger at all the second time (via a trigger condition), rather than triggering and then aborting.

@ganeshsanap the UserVoice page no longer exists... is there a replacement for it?  For me, it seems crazy that you cannot use Name in a calculated column, and instead have to resort to using a flow to track the name with a custom column!

1 best response

Accepted Solutions
best response confirmed by NilsRichter (Copper Contributor)
Solution

@NilsRichter 

It's a known limitation of SharePoint. We cannot use file name in calculated column formula.

There is a SharePoint UserVoice for this. You can vote here: Use filename in calculated field

Workaround:

  1. Create a new text field & populate its value using workflow on item creation/update. Hide this field from property forms.

  2. Use workflow to updated the Title field based on the filename. Then use Title field in the calculated column formula.


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.

View solution in original post