Commit b908cc5
authored
PLU-469: add fix for excel get table row implementation (#960)
## Problem
Excel `getTopNTableRows` is buggy because `usedRange` includes all
non-empty cells (not limited to a table)
It can accidentally include:
- Stray formatting
- Other tables if you resize too far
There's no way to limit `usedRange` to a table specifically — it works
on worksheet or relative range context
## Solution
Considered using the `rows` API, but it involves pagination so the query
takes around 5s for a table of 50k rows
Also considered using the `columns` API, but it does not return the
`headerSheetRowIndex` address so another API query has to be made to
obtain it
Eventually settled on using `range` which gives both the header row and
data rows as well as the `headerSheetRowIndex`, keeping the API call to
still be 1
## Tests
`getTableRow` action:
- [ ] Works for multiple found rows (the first row found is returned)
- [ ] Values outside the table will not be retrieved
`updateTableRow` action:
- [ ] Works for multiple found rows (the first row found is returned)
- [ ] Values outside the table will not be retrieved1 parent f6948b7 commit b908cc5
File tree
1 file changed
+63
-0
lines changed- packages/backend/src/apps/m365-excel/actions/get-table-row/implementation
1 file changed
+63
-0
lines changedLines changed: 63 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
19 | 33 | | |
20 | 34 | | |
21 | 35 | | |
22 | 36 | | |
23 | 37 | | |
24 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
25 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
26 | 89 | | |
27 | 90 | | |
28 | 91 | | |
| |||
0 commit comments