Skip to content

Commit

Permalink
clarify docs around loading cells
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo Ephraim committed Nov 14, 2021
1 parent 4cec425 commit c1d2f23
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ More info:

### Working with cells
```javascript
await sheet.loadCells('A1:E10'); // loads a range of cells
await sheet.loadCells('A1:E10'); // loads range of cells into local cache - DOES NOT RETURN THE CELLS
console.log(sheet.cellStats); // total cells, loaded, how many non-empty
const a1 = sheet.getCell(0, 0); // access cells using a zero-based index
const c6 = sheet.getCellByA1('C6'); // or A1 style notation
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ More info:

### Working with cells
```javascript
await sheet.loadCells('A1:E10'); // loads a range of cells
await sheet.loadCells('A1:E10'); // loads range of cells into local cache - DOES NOT RETURN THE CELLS
console.log(sheet.cellStats); // total cells, loaded, how many non-empty
const a1 = sheet.getCell(0, 0); // access cells using a zero-based index
const c6 = sheet.getCellByA1('C6'); // or A1 style notation
Expand Down
8 changes: 5 additions & 3 deletions docs/classes/google-spreadsheet-worksheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ The cell-based interface lets you load and update individual cells in a sheeet,
#### `loadCells(filters)` (async) :id=fn-loadCells
> Fetch cells from google
You can filter the cells you want to fetch in several ways. See [Data Filters](https://developers.google.com/sheets/api/reference/rest/v4/DataFilter) for more info. Strings are treated as A1 ranges, objects are detected to be a [GridRange](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#GridRange) with sheetId not required.
!> This method does not return the cells it loads, instead they are kept in a local cache managed by the sheet. See methods below (`getCell` and `getCellByA1`) to access them.

**NOTE - if using an API key (read-only access), only A1 ranges are supported**
You can filter the cells you want to fetch in several ways. See [Data Filters](https://developers.google.com/sheets/api/reference/rest/v4/DataFilter) for more info. Strings are treated as A1 ranges, objects are detected to be a [GridRange](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#GridRange) with sheetId not required.

```javascript
await sheet.loadCells(); // no filter - will load ALL cells in the sheet
Expand All @@ -150,11 +150,13 @@ await sheet.loadCells({ startRowIndex: 50 }); // not all props required
await sheet.loadCells(['B2:D5', 'B50:D55']); // can pass an array of filters
```

!> If using an API key (read-only access), only A1 ranges are supported

Param|Type|Required|Description
---|---|---|---
`filters`|*|-|Can be a single filter or array of filters

-**Side effects** - cells are loaded in the doc, `cellStats` is updated
-**Side effects** - cells are loaded into local cache, `cellStats` is updated


#### `getCell(rowIndex, columnIndex)` :id=fn-getCell
Expand Down

0 comments on commit c1d2f23

Please sign in to comment.