🍄Range
Google Apps Script class for Google Sheet
Last updated
Was this helpful?
Google Apps Script class for Google Sheet
Last updated
Was this helpful?
Was this helpful?
getNumColumns() - number of columns.
選取 Range:
💾 sheet.rangeByRect() - 簡化 Range 的選取。
range.offset() - 如果位移的量沒有設好,會出現類似以下錯誤: ⛔ Exception: The starting row of the range is too small.
設定儲存格公式:
合併儲存格:
水平合併:mergeAcross() (如果有好幾列,每列會分別合併)
垂直合併:mergeVertically()
設定字體:
字體顏色:setFontColor(), setFontColors(), setFontColorObject(), ...
字體大小:setFontSize()
字體粗細:
同一個儲存格內設定不同的字體: ⭐️
設定顏色:
儲存格背景色:setBackground()
💾 sheet.rangeByRect() - 簡化選取 Range
💡 custom prototypes for Range objects.
GAS ⟩ ThemeColorType (enum)
getSheet() - sheet (Sheet) this range belongs to.
Sheet ⟩ getRangeList(a1Notations)
Cells - internal data structure of a cell
相關試算表指令:
=ADDRESS() - row/col number to A1/R1C1 notation.
=ROW() - row number of a cell.
=COLUMN() - column number of a cell.
// column widths
sheet.setColumnWidths(startColumn, numColumns, width)
// background color
range.setBackground('red') // 使用顏色名稱
range.setBackground('#eeeeee') // 使用 RGB 顏色碼
range.setBackground() // 重設背景色
// alignment
range
.setVerticalAlignment('middle') // 'top', 'middle', 'bottom'
.setHorizontalAlignment('center'); // 'left', 'center', 'normal'