In my Google Sheet, I currently remove formatting by manually going to Format > Clear Formatting
.
How can I programmatically (via Apps Script) clear any/all formatting that may exist in a Google Sheet's row(s) and/or column(s)?
Clarification: I am aware of the Text Class that has formatting functions (eg. setForegroundColor(), setItalic(), setTextAlignment(), etc), but I'm not aware of any single function that will do the same thing as the Format > Clear Formatting
function that is available in the Main Menu.
There is a clearFormats() method in the Sheet Class.
https://developers.google.com/apps-script/reference/spreadsheet/sheet#clearformats
Example from the docs:
// This example assumes there is a sheet named "first"
var ss = SpreadsheetApp.getActiveSpreadsheet();
var first = ss.getSheetByName("first");
first.clearFormats();
The clearFormat()
function I am looking for is in the Range Class
.
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