2

It is very tedious to go through all the steps over and over in every Google Sheet to change the default font away from Arial to something that doesn't make my eyes bleed. Is there a way to automate this?

One possibility would be a way to add a menu item (written in Google script?) that does it for the current sheet.

Another possibility would be to somehow access a Google API to cycle through all of the sheets I own (or all the sheets I have edit rights to) and change the default font.

1
  • It seems that your question lacks practicality and detail. I suggest taking a look at the tour and How to Ask sections for guidance. When asking your question, it would be helpful to focus on one specific possibility and include any attempts you've made and your findings from this site. May 20, 2023 at 6:19

2 Answers 2

2

CHANGE DEFAULT FONT FOR ENTIRE SPREADSHEET

/* this script will change the default font family for the ENTIRE spreadsheet
// it will NOT modify a range where the font has been set manually.
*/
function changeFont() {
  var ss = SpreadsheetApp.getActiveSpreadsheet()
  
  // get the starting font
  var thisfont = ss.getSpreadsheetTheme().getFontFamily()
  Logger.log("DEBUG: the starting font = "+thisfont)

  // set the name of the new font
  // just type the name of the font
  var newfont = "Caveat"
  // change the font
  ss.getSpreadsheetTheme().setFontFamily(newfont)
  Logger.log("DEBUG: changed the font to "+newfont)

  // confirm that changed font
  var currentfont = ss.getSpreadsheetTheme().getFontFamily()
  Logger.log("DEBUG: post-change font is now = "+currentfont)
 
}

DEBUG Comments

  • DEBUG: the starting font = Arial
  • DEBUG: changed the font to Caveat
  • DEBUG: post-change font is now = Caveat

Before

before


After

after

1

CHANGE DEFAULT FONT FOR SINGLE SHEET

/* this script will set the font for a single sheet
// 
*/
function changeSheetFont() {
  var ss = SpreadsheetApp.getActiveSpreadsheet()
  var sheet = ss.getActiveSheet()

  // select the entire range
  var thissheet = sheet.getRange(1, 1, sheet.getMaxRows(), sheet.getMaxColumns())
  //var cell = sheet.getRange("B2");

  // set the name of the new font
  // just type the name of the font
  var newfont = "Helvetica"
  thissheet.setFontFamily(newfont)

}

BEFORE

beforesheet


AFTER

after

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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