Forum Discussion
ksabuda
Sep 07, 2022Copper Contributor
Import CSV data and turn it into a colored box
Hi, I'm looking for a solution that would easily (at least when it comes to the final result) convert csv data into a colored indicator that could be implemented in a SharePoint page. To make...
RobElliott
Sep 07, 2022Silver Contributor
ksabuda manually copy & paste the csv data into a SharePoint list. You could do it automatically with a flow in Power Automate but would need to convert it to an excel spreadsheet table first. In your list you would format your column (column setings -> format this column) and in advanced mode paste in the following JSON adjusting the values etc to taste:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "@currentField",
"style": {
"background-color": "=if(@currentField >= 15, 'red', if(@currentField >=10 &&@currentField<15, 'gold','green')",
"color": "=if(@currentField >= 15, 'white', if(@currentField >=10 &&@currentField<15, 'black','white')",
"padding-left": "4px"
}
}
Finally on your SharePoint page add a list web part and point it to the list.
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)