# Sheet

[GAS](..) ⟩ [Classes]() ⟩ Sheet

{% tabs %}
{% tab title="📍 屬性" %}
* 選取 [range](range "mention")
  * [getRange()](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en#getrangerow,-column,-numrows,-numcolumns)
* 內容、格式：
  * [clear()](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en#clear)
  * [clear({ formatOnly: true, contentsOnly: true })](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en#clearoptions)
* 欄位寬度、高度：
  * [setRowHeight()](https://developers.google.com/apps-script/reference/spreadsheet/sheet#setrowheightrowposition,-height)
  * [setColumnWidths()](https://developers.google.com/apps-script/reference/spreadsheet/sheet#setcolumnwidthsstartcolumn,-numcolumns,-width)
{% endtab %}

{% tab title="💾 程式" %}
💈排版

```javascript
// column widths
sheet.setColumnWidths(startColumn, numColumns, width) 

// auto-resize
sheet.autoResizeColumns(startColumn, numColumns)   // ⭐️ resize columns
sheet.autoResizeRows(startRow, numRows)            // ⭐️ resize rows
```
{% endtab %}

{% tab title="📗 參考" %}
* [ ] Spreadsheet.Dev ⟩ [Automatically resize rows & columns](https://spreadsheet.dev/auto-resize-rows-columns-google-sheets-apps-script)
{% endtab %}

{% tab title="📘 手冊" %}
* [Sheet](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en) ⟩&#x20;
  * [.autoResizeColumns(startColumn, numColumns)](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en#autoresizecolumnsstartcolumn,-numcolumns)
  * [.autoResizeRows(startRow, numRows)](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en#autoresizerowsstartrow,-numrows)
  * [clear()](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en#clear) - 清除所有內容、格式。
  * [clear({ formatOnly: true, contentsOnly: true })](https://developers.google.com/apps-script/reference/spreadsheet/sheet?hl=en#clearoptions) - 可選擇只清除內容或格式。
{% endtab %}

{% tab title="👥 相關" %}
* [app.sheet.prototype](../app/prototypes/app.sheet.prototype "mention") - extend Sheet.
* [kuai-su-diao-zheng-lan-wei-kuan-du](../tips/kuai-su-diao-zheng-lan-wei-kuan-du "mention")
* [range](range "mention")
* [app.sheet.prototype](../app/prototypes/app.sheet.prototype "mention") extends Sheet.
* [custom-prototypes](../tips/custom-prototypes "mention") for Sheet objects.
{% endtab %}
{% endtabs %}
