# GAS ⟩ commands

{% tabs %}
{% tab title="Sheet" %}
* add sheet
  * ss.[insertSheet](https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#insertsheetsheetname)(name)
  * ss.[insertSheet](https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#insertsheetsheetname,-sheetindex)(name, index)
  * ss.[getNumSheets](https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#getnumsheets)()
* delete sheet
  * ss.[deleteSheet](https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#deletesheetsheet)(sheet)
  * ss.[getSheetByName](https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#getsheetbynamename)(name)
  * ss.[getSheets](https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#getsheets)()
  * sheet.[getName](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en#getname)()
* move sheet
  * ss.[moveActiveSheet](https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet#moveactivesheetpos)(pos)
{% endtab %}

{% tab title="Range" %}
* **get range**
  * <mark style="color:orange;">**sheet**</mark>[.getRange(row, column)](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en#getrangerow,-column)&#x20;
  * 👉 compare: <mark style="color:red;">**range**</mark>[.getCell(row, column)](https://developers.google.com/apps-script/reference/spreadsheet/range?hl=en#getcellrow,-column)
* cell value(s)
  * range[.getValue()](https://developers.google.com/apps-script/reference/spreadsheet/range?hl=en#getvalue) - value of the <mark style="color:red;">**top-left cell**</mark> in the range.
  * range[.getValues()](https://developers.google.com/apps-script/reference/spreadsheet/range?hl=en#getvalues) - <mark style="color:red;">**2D array**</mark> of values.
* formula
  * range.[setFormula](https://developers.google.com/apps-script/reference/spreadsheet/range?hl=en#setformulaformula)()
  * range.[setFormulaR1C1](https://developers.google.com/apps-script/reference/spreadsheet/range?hl=en#setformular1c1formula)()
* format
  * range.[setNumberFormat](https://developers.google.com/apps-script/reference/spreadsheet/range?hl=en#setnumberformatnumberformat)()
  * range.[setNumberFormats](https://developers.google.com/apps-script/reference/spreadsheet/range?hl=en#setnumberformatsnumberformats)()
  * [number & date formats](https://developers.google.com/sheets/api/guides/formats)
* conditional format
  * sheet.[getConditionalFormatRules](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en#getconditionalformatrules)()
  * sheet.[setConditionalFormatRules](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en#setconditionalformatrulesrules)()
  * SpreadsheetApp.[newConditionalFormatRule](https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app?hl=en#newconditionalformatrule)()
  * builder.[whenNumberLessThan](https://developers.google.com/apps-script/reference/spreadsheet/conditional-format-rule-builder#whenNumberLessThan\(Number\))()
  * builder.[setBackground](https://developers.google.com/apps-script/reference/spreadsheet/conditional-format-rule-builder#setbackgroundcolor)()
  * builder.[setRanges](https://developers.google.com/apps-script/reference/spreadsheet/conditional-format-rule-builder#setrangesranges)()
{% endtab %}

{% tab title="📘 手冊" %}
* [SpreadsheetApp](https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app?hl=en) - 設定條件格式
* [SpreadSheet](https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet)
* [Sheet](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en)
* [Range](https://developers.google.com/apps-script/reference/spreadsheet/range?hl=en)
* [Logger](https://developers.google.com/apps-script/reference/base/logger) - Logger.[log](https://developers.google.com/apps-script/reference/base/logger#logdata)()
* [Triggers](https://developers.google.com/apps-script/guides/triggers) - event handlers: [onOpen](https://developers.google.com/apps-script/guides/triggers#onopene)(), [onEdit](https://developers.google.com/apps-script/guides/triggers#onedite)() ...
{% endtab %}
{% endtabs %}

