Import CSV data and turn it into a colored box

Copper Contributor

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 it clear:

1. I have some data that will be exported automatically from SAP in the form of a CSV file.

2. There are two values in the CSV file that are vital, all the others are not.

3. I would like to place something in a SharePoint page that would automatically import and turn the data from the CSV file into a colored box (green - yellow - red) depending on the value range of the data.

 

I hope the description is clear :) As I'm new to the SharePoint environment, hopefully someone here could advise on a solution that would be suitable for this application.

 

Thanks!

1 Reply

@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.

 

RiskEmbed.png

 

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)