I need a way to remove all conditional formatting by running a script (my client will be using this and he doesn't want to have to repeat the process of removing conditional formatting for each worksheet in each of a large number of spreadsheet files).
Is there any way to do this via Google Apps script? All I see is .clearFormat()
, which unfortunately clears all formatting, of which a lot should not be deleted (eg, font color, bg color, font, font weight, font rotation, cell outlines)
How to do this in such a way that only one button needs to be pressed for each spreadsheet file?
Point your mouse to the condition that needs to be deleted and click the "Remove" icon. Conditional formatting will be cleared. If you don't remember the exact cell range you formatted, or if you want to get rid of formats as quickly as possible, then select the cell range and go to the Format menu - Clear formatting.
To remove conditional formatting from a range of formatted cells, select the range and in the Ribbon, go to Home > Conditional Formatting > Clear Rules > Clear Rules from Selected Cells. As a result, all formatting rules are now cleared. Conditional formatting can also be removed from the entire sheet at once.
Google Apps Scripts now supports removing conditional formatting using clearConditionalFormatRules
var sheet = SpreadsheetApp.getActiveSheet();
sheet.clearConditionalFormatRules();
https://developers.google.com/apps-script/reference/spreadsheet/sheet#clearconditionalformatrules
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With