2

So I have this SharePoint list, and currently I have 3 columns, each using JSON to change the color depending on the data entered. for example, say that "Yes" is entered into the column1, it will turn green. If no is entered, it will turn red.

Basic examples of course, but much more complicated in the actual list. So my question is, these three columns are kind of like templates, and their JSON is going to be used in up to 100 other columns.

Now do I have to go to every single column, and copy and paste this code, or can I have one big script that will apply these conditions to all the other columns?

Ex. column1 filters by yes or no, and I need to also do this is columns 50 to 120.

Now I don't want to copy and paste the code 70 times into these other columns. What can I do. (sorry, kinda new to json)

3

There is no way to apply JSON formatting to multiple columns at a time using SharePoint out of the box capabilities.

So, you need to use PowerShell and automate this process to apply JSON formatting to multiple columns.

You can find the PowerShell script to get you started with in below references:

  1. SharePoint Online: Apply Column Format using PowerShell
  2. Add Column Formatting with PnP PowerShell

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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