We have document library with .pdf, .docs, .pptx, .url and .jpg type files and file viewer web parts to preview those files. But customer want to remove file Extensions from the Name column and want to keep the link to document with edit menu option in Name column.

So, how can we remove the file extension (.pdf, .pptx, .doc) from the Name column?

1 Answer 1


Refer to this post, we could use column formatting to hide file extension:

   "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
   "elmType": "div",
   "txtContent": "=substring('@currentField',0,indexOf('@currentField', '[$File_x0020_Type]')-1)"

After hiding the file extensions,the file cannot be clickable to open, you could double click the file to open and edit it.

  • Thanks, but this substring removed the folders names also. So, I made some changes in the txtContent: "txtContent": "=if(indexOf('@currentField','.') > 0,substring('@currentField',0,indexOf('@currentField','.')),'@currentField')" Jul 13, 2020 at 5:28
  • Thank you for sharing.
    – Julie_MSFT
    Jul 17, 2020 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.