Skip to content

Commit

Permalink
update docs - fix saveCells, update emojis
Browse files Browse the repository at this point in the history
  • Loading branch information
theoephraim committed Feb 27, 2020
1 parent 85c59bc commit 0102f1c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 36 deletions.
6 changes: 3 additions & 3 deletions docs/classes/google-spreadsheet-cell.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,18 @@ Property|Type|Description
**This is still only a local change which must still be saved**

- :sparkles: **Side effects** - all user entered format settings are cleared (locally)
- **Side effects** - all user entered format settings are cleared (locally)


#### `discardUnsavedChanges()` :id=fn-discardUnsavedChanges
> Discard all unsaved changes - includes value, notes, and formatting
- :sparkles: **Side effects** - cell will no longer be considered "dirty" and unsaved changes are discarded
- **Side effects** - cell will no longer be considered "dirty" and unsaved changes are discarded

#### `save()` (async) :id=fn-save
> Save this individual cell
- :sparkles: **Side effects** - updates are saved and everything re-fetched from google
- **Side effects** - updates are saved and everything re-fetched from google

?> Usually makes more sense to use `sheet.saveUpdatedCells()` to save many cell updates at once

4 changes: 2 additions & 2 deletions docs/classes/google-spreadsheet-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ await row.save(); // cell will now contain the value "ASDF", not the formula
#### `save()` (async) :id=fn-save
> Save any updates made to row values
- :sparkles: **Side effects** - updates are saved and everything re-fetched from google
- **Side effects** - updates are saved and everything re-fetched from google


#### `delete()` (async) :id=fn-delete
> Delete this row
- :sparkles: **Side effects** - Row is removed from the sheet
- **Side effects** - Row is removed from the sheet

_also available as `_row.del()`_

47 changes: 24 additions & 23 deletions docs/classes/google-spreadsheet-worksheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The row-based interface is provided as a simplified way to deal with sheets that
#### `loadHeaderRow()` (async) :id=fn-loadHeaderRow
> Loads the header row (first row) of the sheet
_usually do not need to call this directly_
- :sparkles: **Side effects** - `sheet.headerValues` is populated
- **Side effects** - `sheet.headerValues` is populated

#### `setHeaderRow(headerValues)` (async) :id=fn-setHeaderRow
> Set the header row (first row) of the sheet
Expand All @@ -75,7 +75,7 @@ Param|Type|Required|Description
---|---|---|---
`headerValues`|[String]|✅|Array of strings to set as cell values in first row

- :sparkles: **Side effects** - first row of the sheet is filled, `sheet.headerValues` is populated
- **Side effects** - first row of the sheet is filled, `sheet.headerValues` is populated

#### `addRow(rowValues)` (async) :id=fn-addRow
> Append a new row to the sheet
Expand All @@ -87,8 +87,8 @@ Param|Type|Required|Description



- :leftwards_arrow_with_hook: **Returns** - [GoogleSpreadsheetRow](classes/google-spreadsheet-row) (in a promise)
- :sparkles: **Side effects** - row is added to the sheet
- ↩️ **Returns** - [GoogleSpreadsheetRow](classes/google-spreadsheet-row) (in a promise)
- **Side effects** - row is added to the sheet


#### `addRows(arrayOfRowValues)` (async) :id=fn-addRows
Expand All @@ -98,8 +98,8 @@ Param|Type|Required|Description
---|---|---|---
`arrayOfRowValues`|Array|✅|Array of rows values to append to the sheet<br>_see [`sheet.addRow()`](#fn-addRow) above for more info_

- :leftwards_arrow_with_hook: **Returns** - [[GoogleSpreadsheetRow](classes/google-spreadsheet-row)] (in a promise)
- :sparkles: **Side effects** - rows are added to the sheet
- ↩️ **Returns** - [[GoogleSpreadsheetRow](classes/google-spreadsheet-row)] (in a promise)
- **Side effects** - rows are added to the sheet


#### `getRows(options)` (async) :id=fn-getRows
Expand All @@ -111,8 +111,8 @@ Param|Type|Required|Description
`options.offset`|Number<br>_int >= 0_|-|How many rows to skip from the top
`options.limit`|Number<br>_int > 0_|-|Max number of rows to fetch

- :leftwards_arrow_with_hook: **Returns** - [[GoogleSpreadsheetRow](classes/google-spreadsheet-row)] (in a promise)
- :sparkles: **Side effects** - row is added to the sheet
- ↩️ **Returns** - [[GoogleSpreadsheetRow](classes/google-spreadsheet-row)] (in a promise)
- **Side effects** - row is added to the sheet

!> The older version of this module allowed you to filter and order the rows as you fetched them, but this is no longer supported by google

Expand Down Expand Up @@ -140,7 +140,7 @@ Param|Type|Required|Description
---|---|---|---
`filters`|*|-|Can be a single filter or array of filters

- :sparkles: **Side effects** - cells are loaded in the doc, `cellStats` is updated
- **Side effects** - cells are loaded in the doc, `cellStats` is updated


#### `getCell(rowIndex, columnIndex)` :id=fn-getCell
Expand All @@ -151,7 +151,7 @@ Param|Type|Required|Description
`rowIndex`|Number<br>_int >= 0_|✅|Row of the cell
`columnIndex`|Number<br>_int >= 0_|✅|Column of the cell to retrieve

- :leftwards_arrow_with_hook: **Returns** - [GoogleSpreadsheetCell](classes/google-spreadsheet-cell)
- ↩️ **Returns** - [GoogleSpreadsheetCell](classes/google-spreadsheet-cell)


#### `getCellByA1(a1Address)` :id=fn-getCellByA1
Expand All @@ -161,24 +161,25 @@ Param|Type|Required|Description
---|---|---|---
`a1Address`|String|✅|Address of the cell<br>_ex: "B5"_

- :leftwards_arrow_with_hook: **Returns** - [GoogleSpreadsheetCell](classes/google-spreadsheet-cell)
- ↩️ **Returns** - [GoogleSpreadsheetCell](classes/google-spreadsheet-cell)


#### `saveUpdatedCells()` (async) :id=fn-saveUpdatedCells
> saves all cells that have unsaved changes
> saves all cells in the sheet that have unsaved changes
- :sparkles: **Side effects** - cells are saved, data refreshed from google
- **Side effects** - cells are saved, data refreshed from google

#### `saveCells(cells)` (async) :id=fn-saveCells
> saves all cells that have unsaved changes
> saves specific cells
Param|Type|Required|Description
---|---|---|---
`cells`|[[GoogleSpreadsheetCell](classes/google-spreadsheet-cell)]|✅|Array of cells to save

- :sparkles: **Side effects** - cells are saved, data refreshed from google
- 🚨 **Warning** - At least one cell must have something to save
-**Side effects** - cells are saved, data refreshed from google

?> Easier to just use `sheet.saveUpdatedCells`
?> Usually easier to just use `sheet.saveUpdatedCells`


#### `resetLocalCache(dataOnly)` :id=fn-resetLocalCache
Expand All @@ -188,7 +189,7 @@ Param|Type|Required|Description
---|---|---|---
`dataOnly`|Boolean|-|If true, only affects data, not properties

- :sparkles: **Side effects** - cache is emptied so props and cells must be re-fetched
- **Side effects** - cache is emptied so props and cells must be re-fetched



Expand All @@ -200,15 +201,15 @@ Param|Type|Required|Description
For example: `await sheet.updateProperties({ title: 'New sheet title' });`<br>
See [basic sheet properties](#basic-sheet-properties) above for props documentation.

- :sparkles: **Side Effects -** props are updated
- **Side Effects -** props are updated

#### `resize(props)` (async) :id=fn-resize
> Update grid properties / dimensions
Just a shorcut for `(props) => sheet.updateProperties({ gridProperties: props })`<br>
Example: `await sheet.resize({ rowCount: 1000, columnCount: 20 });`

- :sparkles: **Side Effects -** grid properties / dimensions are updated
- **Side Effects -** grid properties / dimensions are updated

_also available as `sheet.updateGridProperties()`_

Expand All @@ -223,20 +224,20 @@ Param|Type|Required|Description
`bounds.startIndex`|Number<br>_int >= 0_|-|Start row/column
`bounds.endIndex`|Number<br>_int >= 0_|-|End row/column

- :sparkles: **Side effects** - sheet is updated
- **Side effects** - sheet is updated


### Other

#### `clear()` (async) :id=fn-clear
> Clear all data/cells in the sheet
- :sparkles: **Side Effects -** clears the entire sheet, resets local cache
- **Side Effects -** clears the entire sheet, resets local cache

#### `delete()` (async) :id=fn-delete
> Delete this sheet
- :sparkles: **Side Effects -** sheet is deleted and removed from `doc.sheetsById` and `doc.sheetsByIndex`
- **Side Effects -** sheet is deleted and removed from `doc.sheetsById` and `doc.sheetsByIndex`

_also available as `sheet.del()`_

Expand All @@ -247,7 +248,7 @@ Param|Type|Required|Description
---|---|---|---
`destinationSpreadsheetId`|String|✅|ID of another spreadsheet document

- :sparkles: **Side Effects -** sheet is copied to the other doc
- **Side Effects -** sheet is copied to the other doc

?> The authentication method being used must have access to the destination document as well

16 changes: 8 additions & 8 deletions docs/classes/google-spreadsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Param|Type|Required|Description
`creds.client_email`|String<br>_email_|✅|The email of your service account
`creds.private_key`|String|✅|The private key for your service account

- :sparkles: **Side effects** - all requests will now authenticate using these credentials
- **Side effects** - all requests will now authenticate using these credentials

> See [Getting Started > Authentication](getting-started/authentication) for more details
Expand All @@ -70,7 +70,7 @@ Param|Type|Required|Description
---|---|---|---
`key`|String|✅|API key for your google project

- :sparkles: **Side effects** - all requests will now authenticate using this api key only
- **Side effects** - all requests will now authenticate using this api key only

> See [Getting Started > Authentication](getting-started/authentication) for more details
Expand All @@ -80,7 +80,7 @@ Param|Type|Required|Description
#### `loadInfo()` (async) :id=fn-loadInfo
> Load basic document props and child sheets
- :sparkles: **Side Effects -** props are populated, sheets are populated
- **Side Effects -** props are populated, sheets are populated

#### `updateProperties(props)` (async) :id=fn-updateProperties
> Update basic document properties
Expand All @@ -91,15 +91,15 @@ await doc.updateProperties({ title: 'New title' });
```
See [basic document properties](#basic-document-properties) above for props documentation.

- :sparkles: **Side Effects -** props are updated
- **Side Effects -** props are updated


#### `resetLocalCache()` :id=fn-resetLocalCache
> Clear local cache of properties and sheets
You must call `loadInfo()` again to re-load the properties and sheets

- :sparkles: **Side Effects -** basic props and sheets are gone
- **Side Effects -** basic props and sheets are gone


### Managing Sheets
Expand All @@ -115,8 +115,8 @@ Param|Type|Required|Description
`props.[more]`|...|-|_See [GoogleSpreadsheetWorksheet](classes/google-spreadsheet-worksheet#basic-document-properties) for more props_


- :leftwards_arrow_with_hook: **Returns** - [GoogleSpreadsheetWorksheet](classes/google-spreadsheet-worksheet) (in a promise)
- :sparkles: **Side effects** - new sheet is now added to `doc.sheetsByIndex` and `doc.sheetsById`
- ↩️ **Returns** - [GoogleSpreadsheetWorksheet](classes/google-spreadsheet-worksheet) (in a promise)
- **Side effects** - new sheet is now added to `doc.sheetsByIndex` and `doc.sheetsById`

_Also available as `addWorksheet()`_

Expand All @@ -128,7 +128,7 @@ Param|Type|Required|Description
---|---|---|---
`sheetId`|String|✅|ID of the sheet to remove

- :sparkles: **Side effects** - sheet is removed from `doc.sheetsByIndex` and `doc.sheetsById`
- **Side effects** - sheet is removed from `doc.sheetsByIndex` and `doc.sheetsById`

?> **TIP** - Usually easier to use GoogleSpreadsheetWorksheet instance method `delete()`

Expand Down

0 comments on commit 0102f1c

Please sign in to comment.