简体   繁体   中英

How to get font size to show up in a cell in Google Sheets

i've been looking everywhere for solution.

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) }

Any help would be appreciated as i am a script app noob!

I believe your goal is as follows.

  • You want to retrieve the font size.
  • From your showing script, you might want to achieve this as a custom function.

In this case, how about the following modification?

Modified script:

function FONTSIZE(range) {
  return SpreadsheetApp.getActiveSheet().getRange(range).getFontSizes();
}
  • In this case, please put a custom function like =FONTSIZE("A1") and =FONTSIZE("A1:C3") in a cell. By this, the font size of the cell "A1" is returned.

Note:

  • When I saw your showing document of the URL, it seems that it is for Google Slides. If you want to use this with Google Spreadsheet, please use getFontSize() and/or getFontSizes() .

References:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM