google-apps-scriptgoogle-sheetsgoogle-sheets-formula

How to get font size to show up in a cell


I want to create an app script on Google Sheets that creates a custom formula to show what font size text a cell contains.

I found Google has a function "getFontSize", but no luck in getting it to work:

function FONTSIZE(range) {
  return getFontSize(Number)
}

Solution

  • I believe your goal is as follows.

    In this case, how about the following modification?

    Modified script:

    function FONTSIZE(range) {
      return SpreadsheetApp.getActiveSheet().getRange(range).getFontSizes();
    }
    

    Note:

    References: