Here is a method for you:
1.Create a text column.
2.Select the column -> Column settings -> Format this column -> Use following codes.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"style": {
"border-radius": "5px",
"margin": "5px 0px",
"padding": "0px",
"visibility": "=if([$File_x0020_Type] == '', 'hidden', 'visible')"
},
"attributes": {
"class": "ms-bgColor-themePrimary"
},
"children": [
{
"elmType": "a",
"txtContent": "Download",
"style": {
"text-decoration": "none",
"padding": "10px 0px",
"width": "100%"
},
"attributes": {
"href": "= @currentWeb + '/_layouts/15/download.aspx?UniqueId=' + [$UniqueId]",
"target": "_blank",
"class": "ms-fontColor-white"
}
}
]
}
3.Result. Then click download button to download files.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.