microsoft-graph 2.32.0 → 2.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/models/Cell.d.ts +24 -33
- package/dist/cjs/models/Cell.d.ts.map +1 -1
- package/dist/cjs/operations/workbookRange/getWorkbookRangeFormat.d.ts.map +1 -1
- package/dist/cjs/operations/workbookRange/getWorkbookRangeFormat.js +1 -0
- package/dist/cjs/operations/workbookRange/getWorkbookWorksheetRange.d.ts.map +1 -1
- package/dist/cjs/operations/workbookRange/getWorkbookWorksheetRange.js +1 -5
- package/dist/cjs/services/dataSource.js +5 -7
- package/dist/cjs/services/stringCaseConversion.d.ts +6 -0
- package/dist/cjs/services/stringCaseConversion.d.ts.map +1 -1
- package/dist/cjs/services/stringCaseConversion.js +12 -0
- package/dist/cjs/tasks/insertWorkbookRangeRow.d.ts +18 -0
- package/dist/cjs/tasks/insertWorkbookRangeRow.d.ts.map +1 -0
- package/dist/cjs/tasks/insertWorkbookRangeRow.js +24 -0
- package/dist/cjs/tasks/insertWorkbookRangeRows.d.ts +31 -0
- package/dist/cjs/tasks/insertWorkbookRangeRows.d.ts.map +1 -0
- package/dist/cjs/tasks/insertWorkbookRangeRows.js +80 -0
- package/dist/cjs/tasks/iterateWorkbookRange.d.ts.map +1 -1
- package/dist/cjs/tasks/iterateWorkbookRange.js +5 -7
- package/dist/cjs/tasks/{iterateRows.d.ts → iterateWorkbookRangeRows.d.ts} +3 -4
- package/dist/cjs/tasks/iterateWorkbookRangeRows.d.ts.map +1 -0
- package/dist/cjs/tasks/{iterateRows.js → iterateWorkbookRangeRows.js} +59 -39
- package/dist/{esm/tasks/readFirstRow.d.ts → cjs/tasks/readWorkbookRangeFirstRow.d.ts} +2 -2
- package/dist/cjs/tasks/readWorkbookRangeFirstRow.d.ts.map +1 -0
- package/dist/cjs/tasks/{readFirstRow.js → readWorkbookRangeFirstRow.js} +4 -4
- package/dist/{esm/tasks/readRows.d.ts → cjs/tasks/readWorkbookRangeRows.d.ts} +3 -3
- package/dist/cjs/tasks/readWorkbookRangeRows.d.ts.map +1 -0
- package/dist/cjs/tasks/{readRows.js → readWorkbookRangeRows.js} +5 -5
- package/dist/cjs/tasks/readWorkbookRows.d.ts.map +1 -1
- package/dist/cjs/tasks/readWorkbookRows.js +5 -8
- package/dist/cjs/tasks/updateWorkbookRangeFirstRow.d.ts +26 -0
- package/dist/cjs/tasks/updateWorkbookRangeFirstRow.d.ts.map +1 -0
- package/dist/cjs/tasks/updateWorkbookRangeFirstRow.js +33 -0
- package/dist/cjs/tasks/updateWorkbookRangeRows.d.ts +26 -0
- package/dist/cjs/tasks/updateWorkbookRangeRows.d.ts.map +1 -0
- package/dist/cjs/tasks/updateWorkbookRangeRows.js +255 -0
- package/dist/cjs/tasks/writeWorkbookRows.js +4 -4
- package/dist/esm/models/Cell.d.ts +24 -33
- package/dist/esm/models/Cell.d.ts.map +1 -1
- package/dist/esm/operations/workbookRange/getWorkbookRangeFormat.d.ts.map +1 -1
- package/dist/esm/operations/workbookRange/getWorkbookRangeFormat.js +1 -0
- package/dist/esm/operations/workbookRange/getWorkbookWorksheetRange.d.ts.map +1 -1
- package/dist/esm/operations/workbookRange/getWorkbookWorksheetRange.js +1 -5
- package/dist/esm/services/dataSource.js +5 -7
- package/dist/esm/services/stringCaseConversion.d.ts +6 -0
- package/dist/esm/services/stringCaseConversion.d.ts.map +1 -1
- package/dist/esm/services/stringCaseConversion.js +11 -0
- package/dist/esm/tasks/insertWorkbookRangeRow.d.ts +18 -0
- package/dist/esm/tasks/insertWorkbookRangeRow.d.ts.map +1 -0
- package/dist/esm/tasks/insertWorkbookRangeRow.js +18 -0
- package/dist/esm/tasks/insertWorkbookRangeRows.d.ts +31 -0
- package/dist/esm/tasks/insertWorkbookRangeRows.d.ts.map +1 -0
- package/dist/esm/tasks/insertWorkbookRangeRows.js +74 -0
- package/dist/esm/tasks/iterateWorkbookRange.d.ts.map +1 -1
- package/dist/esm/tasks/iterateWorkbookRange.js +5 -7
- package/dist/esm/tasks/{iterateRows.d.ts → iterateWorkbookRangeRows.d.ts} +3 -4
- package/dist/esm/tasks/iterateWorkbookRangeRows.d.ts.map +1 -0
- package/dist/esm/tasks/{iterateRows.js → iterateWorkbookRangeRows.js} +58 -38
- package/dist/{cjs/tasks/readFirstRow.d.ts → esm/tasks/readWorkbookRangeFirstRow.d.ts} +2 -2
- package/dist/esm/tasks/readWorkbookRangeFirstRow.d.ts.map +1 -0
- package/dist/esm/tasks/{readFirstRow.js → readWorkbookRangeFirstRow.js} +3 -3
- package/dist/{cjs/tasks/readRows.d.ts → esm/tasks/readWorkbookRangeRows.d.ts} +3 -3
- package/dist/esm/tasks/readWorkbookRangeRows.d.ts.map +1 -0
- package/dist/esm/tasks/{readRows.js → readWorkbookRangeRows.js} +4 -4
- package/dist/esm/tasks/readWorkbookRows.d.ts.map +1 -1
- package/dist/esm/tasks/readWorkbookRows.js +5 -8
- package/dist/esm/tasks/updateWorkbookRangeFirstRow.d.ts +26 -0
- package/dist/esm/tasks/updateWorkbookRangeFirstRow.d.ts.map +1 -0
- package/dist/esm/tasks/updateWorkbookRangeFirstRow.js +27 -0
- package/dist/esm/tasks/updateWorkbookRangeRows.d.ts +26 -0
- package/dist/esm/tasks/updateWorkbookRangeRows.d.ts.map +1 -0
- package/dist/esm/tasks/updateWorkbookRangeRows.js +249 -0
- package/dist/esm/tasks/writeWorkbookRows.js +4 -4
- package/docs/api/Cell.md +39 -55
- package/docs/api/CellFormat.md +5 -5
- package/docs/api/README.md +4 -0
- package/docs/api/getWorkbookRangeFormat.md +1 -1
- package/docs/api/getWorkbookWorksheetRange.md +1 -1
- package/docs/api/insertRow.md +34 -0
- package/docs/api/insertRows.md +47 -0
- package/docs/api/iterateRows.md +9 -13
- package/docs/api/readFirstRow.md +3 -3
- package/docs/api/readRows.md +4 -4
- package/docs/api/readWorkbookRows.md +1 -1
- package/docs/api/stringCaseConversion.md +22 -0
- package/docs/api/updateFirstRow.md +45 -0
- package/docs/api/updateRows.md +51 -0
- package/package.json +174 -74
- package/dist/cjs/tasks/iterateRows.d.ts.map +0 -1
- package/dist/cjs/tasks/readFirstRow.d.ts.map +0 -1
- package/dist/cjs/tasks/readRows.d.ts.map +0 -1
- package/dist/esm/tasks/iterateRows.d.ts.map +0 -1
- package/dist/esm/tasks/readFirstRow.d.ts.map +0 -1
- package/dist/esm/tasks/readRows.d.ts.map +0 -1
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update rows in a given workbook range.
|
|
3
|
+
* @module updateRows
|
|
4
|
+
* @category Tasks
|
|
5
|
+
* @experimental
|
|
6
|
+
*/
|
|
7
|
+
import { isEqual } from "lodash";
|
|
8
|
+
import InvalidArgumentError from "../errors/InvalidArgumentError.js";
|
|
9
|
+
import mergeWorkbookRange from "../operations/workbookRange/mergeWorkbookRange.js";
|
|
10
|
+
import setWorkbookRangeBorder from "../operations/workbookRange/setWorkbookRangeBorder.js";
|
|
11
|
+
import setWorkbookRangeFill from "../operations/workbookRange/setWorkbookRangeFill.js";
|
|
12
|
+
import setWorkbookRangeFont from "../operations/workbookRange/setWorkbookRangeFont.js";
|
|
13
|
+
import setWorkbookRangeFormat from "../operations/workbookRange/setWorkbookRangeFormat.js";
|
|
14
|
+
import updateWorkbookRange from "../operations/workbookRange/updateWorkbookRange.js";
|
|
15
|
+
import { superRange } from "../services/addressManipulation.js";
|
|
16
|
+
import { maxCellsPerRequest } from "../services/batch.js";
|
|
17
|
+
import { camelCaseToPascalCase } from "../services/stringCaseConversion.js";
|
|
18
|
+
/**
|
|
19
|
+
* Update rows in a given workbook range.
|
|
20
|
+
* @param originRef Reference to the workbook range to update. Only the upper-left cell is used as an origin point.
|
|
21
|
+
* @param cells Array of arrays of cells to update in the specified range.
|
|
22
|
+
* @param maxCellsPerOperation Prescribe max cells to retrieve per operation. `null` automatically determines value. DO NOT SET EXCEPT FOR ADVANCED TUNING.
|
|
23
|
+
* @remarks `undefined` values are left unchanged. Applying styling to cells is slow, use sparingly.
|
|
24
|
+
* @experimental
|
|
25
|
+
* @example
|
|
26
|
+
* // Basic example:
|
|
27
|
+
* await updateRows(rangeRef, [
|
|
28
|
+
* [{ value: 1 }, { value: 2 }],
|
|
29
|
+
* [{ value: 3 }, { value: 4 }],
|
|
30
|
+
* [{ value: 5 }, { value: 6 }],
|
|
31
|
+
* ]);
|
|
32
|
+
*
|
|
33
|
+
* // Advanced example with cell formatting:
|
|
34
|
+
* await updateRows(rangeRef, [
|
|
35
|
+
* [{ value: "Column A", style: { alignment: { horizontal: "Right" }, font: { bold: true } } }, { value: "Column B", style: { alignment: { horizontal: "Right" }, font: { bold: true } } }],
|
|
36
|
+
* [{ value: 1, format: accountingCellFormat }, { value: "A" }],
|
|
37
|
+
* [{ value: 2, format: accountingCellFormat }, { value: "B" }],
|
|
38
|
+
* ]);
|
|
39
|
+
*/
|
|
40
|
+
export default async function updateWorkbookRangeRows(originRef, cells, maxCellsPerOperation = null) {
|
|
41
|
+
let maxRowsPerOperation = maxCellsPerOperation;
|
|
42
|
+
let colCount = null;
|
|
43
|
+
let rowCount = 0;
|
|
44
|
+
const batch = [];
|
|
45
|
+
for await (const row of cells) {
|
|
46
|
+
if (colCount === null) {
|
|
47
|
+
colCount = row.length;
|
|
48
|
+
}
|
|
49
|
+
else if (colCount !== row.length) {
|
|
50
|
+
throw new InvalidArgumentError("Not all rows have the same number of cells. Ensure all rows are consistent in length.");
|
|
51
|
+
}
|
|
52
|
+
if (maxRowsPerOperation === null) {
|
|
53
|
+
maxRowsPerOperation = calculateMaxRowsPerOperation(colCount, maxCellsPerOperation);
|
|
54
|
+
}
|
|
55
|
+
if (batch.push(row) >= maxRowsPerOperation) {
|
|
56
|
+
rowCount += await writeBatch(batch, originRef, rowCount, colCount);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (colCount !== null) {
|
|
60
|
+
rowCount += await writeBatch(batch, originRef, rowCount, colCount);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async function writeBatch(cells, originRef, rowsCompleted, colCount) {
|
|
64
|
+
const rowCount = cells.length;
|
|
65
|
+
if (rowCount === 0) {
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
const rangeRef = superRange(originRef, rowsCompleted, rowCount, 0, colCount);
|
|
69
|
+
await writeValuesTextFormat(cells, rangeRef);
|
|
70
|
+
await writeMerges(cells, rangeRef, rowCount, colCount);
|
|
71
|
+
await writeAlignment(cells, rangeRef, rowCount, colCount);
|
|
72
|
+
await writeBorders(cells, rangeRef, rowCount, colCount);
|
|
73
|
+
await writeFill(cells, rangeRef, rowCount, colCount);
|
|
74
|
+
await writeFont(cells, rangeRef, rowCount, colCount);
|
|
75
|
+
cells.length = 0;
|
|
76
|
+
return rowCount;
|
|
77
|
+
}
|
|
78
|
+
async function writeValuesTextFormat(cells, rangeRef) {
|
|
79
|
+
const values = cells.map((r) => r.map((c) => c.value));
|
|
80
|
+
const text = cells.map((r) => r.map((c) => c.text));
|
|
81
|
+
const numberFormat = cells.map((r) => r.map((c) => c.format));
|
|
82
|
+
const hasValues = values.some((row) => row.some((value) => value !== undefined && value !== null));
|
|
83
|
+
const hasText = text.some((row) => row.some((value) => value !== undefined && value !== null));
|
|
84
|
+
const hasNumberFormat = numberFormat.some((row) => row.some((value) => value !== undefined && value !== null));
|
|
85
|
+
if (!(hasValues || hasText || hasNumberFormat)) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
await updateWorkbookRange(rangeRef, {
|
|
89
|
+
values: hasValues ? values : undefined,
|
|
90
|
+
text: hasText ? text : undefined,
|
|
91
|
+
numberFormat: hasNumberFormat ? numberFormat : undefined,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
async function writeMerges(cells, rangeRef, rowCount, colCount) {
|
|
95
|
+
const merged = new Array(rowCount).fill(null).map(() => new Array(colCount).fill(false));
|
|
96
|
+
for (let r = 0; r < rowCount; r++) {
|
|
97
|
+
for (let c = 0; c < colCount; c++) {
|
|
98
|
+
if (merged[r]?.[c]) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const merge = cells[r]?.[c]?.merge;
|
|
102
|
+
if (!(merge?.right || merge?.down)) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const rowSpan = (merge.down ?? 0) + 1;
|
|
106
|
+
const colSpan = (merge.right ?? 0) + 1;
|
|
107
|
+
markMerged(r, rowSpan, c, colSpan);
|
|
108
|
+
const subRangeRef = superRange(rangeRef, r, rowSpan, c, colSpan);
|
|
109
|
+
await mergeWorkbookRange(subRangeRef);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function markMerged(r, rowSpan, c, colSpan) {
|
|
113
|
+
for (let rr = r; rr < r + rowSpan; rr++) {
|
|
114
|
+
for (let cc = c; cc < c + colSpan; cc++) {
|
|
115
|
+
if (rr < rowCount && cc < colCount) {
|
|
116
|
+
if (merged[rr][cc]) {
|
|
117
|
+
throw new InvalidArgumentError(`Cell at (${rr}, ${cc}) is involved in multiple merges in this batch.`);
|
|
118
|
+
}
|
|
119
|
+
merged[rr][cc] = true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async function writeAlignment(cells, originRef, rowCount, colCount) {
|
|
126
|
+
await forEachIdenticalRange(cells, rowCount, colCount, originRef, (cell) => cell.alignment, async (subRangeRef, alignment) => {
|
|
127
|
+
await setWorkbookRangeFormat(subRangeRef, {
|
|
128
|
+
verticalAlignment: alignment.vertical ?? null,
|
|
129
|
+
horizontalAlignment: alignment.horizontal ?? null,
|
|
130
|
+
wrapText: alignment.wrapText ?? null,
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
async function writeBorders(cells, originRef, rowCount, colCount) {
|
|
135
|
+
await forEachIdenticalRange(cells, rowCount, colCount, originRef, (cell) => cell.borders, async (subRangeRef, borders) => {
|
|
136
|
+
for (const key of Object.keys(borders)) {
|
|
137
|
+
const edge = camelCaseToPascalCase(key);
|
|
138
|
+
const border = borders[key];
|
|
139
|
+
if (border) {
|
|
140
|
+
await setWorkbookRangeBorder(subRangeRef, edge, border);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
async function writeFill(cells, originRef, rowCount, colCount) {
|
|
146
|
+
await forEachIdenticalRange(cells, rowCount, colCount, originRef, (cell) => cell.fill, async (subRangeRef, fill) => {
|
|
147
|
+
await setWorkbookRangeFill(subRangeRef, fill);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
async function writeFont(cells, originRef, rowCount, colCount) {
|
|
151
|
+
await forEachIdenticalRange(cells, rowCount, colCount, originRef, (cell) => cell.font, async (subRangeRef, font) => {
|
|
152
|
+
await setWorkbookRangeFont(subRangeRef, font);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
async function forEachIdenticalRange(cells, rowCount, colCount, originRef, getValue, callback) {
|
|
156
|
+
const horizontalRanges = findRanges(true);
|
|
157
|
+
const verticalRanges = findRanges(false);
|
|
158
|
+
const bestRanges = horizontalRanges.length <= verticalRanges.length ? horizontalRanges : verticalRanges;
|
|
159
|
+
for (const { rangeRef, value } of bestRanges) {
|
|
160
|
+
await callback(rangeRef, value);
|
|
161
|
+
}
|
|
162
|
+
function idx(r, c) {
|
|
163
|
+
return r * colCount + c;
|
|
164
|
+
}
|
|
165
|
+
function expandHorizontally(r, c, value, visited) {
|
|
166
|
+
let maxCol = c;
|
|
167
|
+
while (maxCol + 1 < colCount && !visited[idx(r, maxCol + 1)] && isEqual(getValue(cells[r]?.[maxCol + 1] ?? {}), value)) {
|
|
168
|
+
maxCol++;
|
|
169
|
+
}
|
|
170
|
+
return maxCol;
|
|
171
|
+
}
|
|
172
|
+
function expandVertically(r, c, value, visited) {
|
|
173
|
+
let maxRow = r;
|
|
174
|
+
while (maxRow + 1 < rowCount && !visited[idx(maxRow + 1, c)] && isEqual(getValue(cells[maxRow + 1]?.[c] ?? {}), value)) {
|
|
175
|
+
maxRow++;
|
|
176
|
+
}
|
|
177
|
+
return maxRow;
|
|
178
|
+
}
|
|
179
|
+
function canExpandRow(r, cStart, cEnd, value, visited) {
|
|
180
|
+
for (let cc = cStart; cc <= cEnd; cc++) {
|
|
181
|
+
if (visited[idx(r, cc)] || !isEqual(getValue(cells[r]?.[cc] ?? {}), value)) {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
function canExpandCol(c, rStart, rEnd, value, visited) {
|
|
188
|
+
for (let rr = rStart; rr <= rEnd; rr++) {
|
|
189
|
+
if (visited[idx(rr, c)] || !isEqual(getValue(cells[rr]?.[c] ?? {}), value)) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
function markVisitedAndPushRange(r, c, maxRow, maxCol, value, visited, ranges) {
|
|
196
|
+
for (let rr = r; rr <= maxRow; rr++) {
|
|
197
|
+
for (let cc = c; cc <= maxCol; cc++) {
|
|
198
|
+
visited[idx(rr, cc)] = true;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (value) {
|
|
202
|
+
const subRangeRef = superRange(originRef, r, maxRow - r + 1, c, maxCol - c + 1);
|
|
203
|
+
ranges.push({
|
|
204
|
+
rangeRef: subRangeRef,
|
|
205
|
+
value,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function expandRange(r, c, value, horizontalFirst, visited) {
|
|
210
|
+
let maxRow = r;
|
|
211
|
+
let maxCol = c;
|
|
212
|
+
if (horizontalFirst) {
|
|
213
|
+
maxCol = expandHorizontally(r, c, value, visited);
|
|
214
|
+
while (maxRow + 1 < rowCount && canExpandRow(maxRow + 1, c, maxCol, value, visited)) {
|
|
215
|
+
maxRow++;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
maxRow = expandVertically(r, c, value, visited);
|
|
220
|
+
while (maxCol + 1 < colCount && canExpandCol(maxCol + 1, r, maxRow, value, visited)) {
|
|
221
|
+
maxCol++;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return { maxRow, maxCol };
|
|
225
|
+
}
|
|
226
|
+
function findRanges(horizontalFirst) {
|
|
227
|
+
const visited = new Array(rowCount * colCount).fill(false);
|
|
228
|
+
const ranges = [];
|
|
229
|
+
for (let r = 0; r < rowCount; r++) {
|
|
230
|
+
for (let c = 0; c < colCount; c++) {
|
|
231
|
+
if (visited[idx(r, c)]) {
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
const value = getValue(cells[r]?.[c] ?? {});
|
|
235
|
+
const { maxRow, maxCol } = expandRange(r, c, value, horizontalFirst, visited);
|
|
236
|
+
markVisitedAndPushRange(r, c, maxRow, maxCol, value, visited, ranges);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return ranges;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function calculateMaxRowsPerOperation(columnCount, overwriteMaxCellsPerOperation) {
|
|
243
|
+
const maxCellsPerOperation = overwriteMaxCellsPerOperation ?? maxCellsPerRequest;
|
|
244
|
+
const maxRowsPerOperation = Math.floor(maxCellsPerOperation / columnCount);
|
|
245
|
+
if (maxRowsPerOperation < 1) {
|
|
246
|
+
throw new InvalidArgumentError("maxCellsPerOperation must be greater than or equal to the number of columns in the range."); // Excel supports up to 16k columns, which exceeds the assumed 10k cell limit per write. This might not be a problem, but not worth spending time checking this currently either.
|
|
247
|
+
}
|
|
248
|
+
return maxRowsPerOperation;
|
|
249
|
+
}
|
|
@@ -23,7 +23,7 @@ import { createWorkbookRangeRef } from "../services/workbookRange.js";
|
|
|
23
23
|
* ]);
|
|
24
24
|
*/
|
|
25
25
|
export default async function writeWorkbookRows(originRef, rows, overwriteMaxRowsPerChunk = null) {
|
|
26
|
-
let
|
|
26
|
+
let maxRowsPerOperation = overwriteMaxRowsPerChunk;
|
|
27
27
|
let cellsPerRow = null;
|
|
28
28
|
let rowsCompleted = 0;
|
|
29
29
|
const batch = [];
|
|
@@ -34,10 +34,10 @@ export default async function writeWorkbookRows(originRef, rows, overwriteMaxRow
|
|
|
34
34
|
else if (cellsPerRow !== row.length) {
|
|
35
35
|
throw new InvalidArgumentError("Not all rows have the same number of cells. Ensure all rows are consistent in length.");
|
|
36
36
|
}
|
|
37
|
-
if (
|
|
38
|
-
|
|
37
|
+
if (maxRowsPerOperation === null) {
|
|
38
|
+
maxRowsPerOperation = Math.max(1, Math.floor(maxCellsPerRequest / cellsPerRow)); // Excel supports up to 16k columns, which exceeds the assumed 10k cell limit per write. This might not be a problem, but not worth spending time checking this currently either.
|
|
39
39
|
}
|
|
40
|
-
if (batch.push(row) >=
|
|
40
|
+
if (batch.push(row) >= maxRowsPerOperation) {
|
|
41
41
|
rowsCompleted += await flushBatch(batch, originRef, rowsCompleted);
|
|
42
42
|
}
|
|
43
43
|
}
|
package/docs/api/Cell.md
CHANGED
|
@@ -22,8 +22,32 @@ Contrary to common expectation, while a cell does contain a single value, it als
|
|
|
22
22
|
|
|
23
23
|
| Property | Type | Description | Defined in |
|
|
24
24
|
| ------ | ------ | ------ | ------ |
|
|
25
|
+
| <a id="alignment"></a> `alignment` | `object` | **`Experimental`** Alignment of cell contents. | [src/models/Cell.ts:46](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L46) |
|
|
26
|
+
| `alignment.horizontal?` | [`CellHorizontalAlignment`](#cellhorizontalalignment) | - | [src/models/Cell.ts:47](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L47) |
|
|
27
|
+
| `alignment.vertical?` | [`CellVerticalAlignment`](#cellverticalalignment) | - | [src/models/Cell.ts:48](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L48) |
|
|
28
|
+
| `alignment.wrapText?` | `boolean` | - | [src/models/Cell.ts:49](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L49) |
|
|
29
|
+
| <a id="borders"></a> `borders` | `object` | **`Experimental`** Borders around the cell. | [src/models/Cell.ts:56](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L56) |
|
|
30
|
+
| `borders.diagonalDown?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:63](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L63) |
|
|
31
|
+
| `borders.diagonalUp?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:64](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L64) |
|
|
32
|
+
| `borders.edgeBottom?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:58](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L58) |
|
|
33
|
+
| `borders.edgeLeft?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:59](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L59) |
|
|
34
|
+
| `borders.edgeRight?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:60](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L60) |
|
|
35
|
+
| `borders.edgeTop?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:57](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L57) |
|
|
36
|
+
| `borders.insideHorizontal?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:62](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L62) |
|
|
37
|
+
| `borders.insideVertical?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:61](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L61) |
|
|
38
|
+
| <a id="fill"></a> `fill` | `object` | **`Experimental`** Fill color of the cell. | [src/models/Cell.ts:71](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L71) |
|
|
39
|
+
| `fill.color?` | [`Color`](Color.md#color) | - | [src/models/Cell.ts:72](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L72) |
|
|
40
|
+
| <a id="font"></a> `font` | `object` | **`Experimental`** Font settings for the cell. | [src/models/Cell.ts:78](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L78) |
|
|
41
|
+
| `font.bold?` | `boolean` | - | [src/models/Cell.ts:82](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L82) |
|
|
42
|
+
| `font.color?` | [`Color`](Color.md#color) | - | [src/models/Cell.ts:81](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L81) |
|
|
43
|
+
| `font.italic?` | `boolean` | - | [src/models/Cell.ts:83](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L83) |
|
|
44
|
+
| `font.name?` | [`FontName`](FontName.md#fontname) | - | [src/models/Cell.ts:79](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L79) |
|
|
45
|
+
| `font.size?` | `number` | - | [src/models/Cell.ts:80](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L80) |
|
|
46
|
+
| `font.underline?` | [`CellUnderline`](#cellunderline) | - | [src/models/Cell.ts:84](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L84) |
|
|
25
47
|
| <a id="format"></a> `format` | [`CellFormat`](#cellformat-1) | Formatting that is applied to the value to derive the text representation. | [src/models/Cell.ts:30](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L30) |
|
|
26
|
-
| <a id="
|
|
48
|
+
| <a id="merge"></a> `merge` | `object` | **`Experimental`** Number of cell merges (WRITE ONLY). **Remarks** Due to API limitations, this value is never populated when reading a cell, but it can be set when writing a cell. | [src/models/Cell.ts:37](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L37) |
|
|
49
|
+
| `merge.down?` | `number` | - | [src/models/Cell.ts:39](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L39) |
|
|
50
|
+
| `merge.right?` | `number` | - | [src/models/Cell.ts:38](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L38) |
|
|
27
51
|
| <a id="text"></a> `text` | [`CellText`](#celltext-1) | The text representation of the cell's value. **Remarks** This is often the same as the value, but can differ in cases where the value is a number and the text representation is formatted (e.g., "1,000" vs. 1000), or in the case of the value being a formula. | [src/models/Cell.ts:20](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L20) |
|
|
28
52
|
| <a id="value"></a> `value` | [`CellValue`](#cellvalue-1) | The actual value of the cell. | [src/models/Cell.ts:25](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L25) |
|
|
29
53
|
|
|
@@ -33,7 +57,7 @@ Contrary to common expectation, while a cell does contain a single value, it als
|
|
|
33
57
|
|
|
34
58
|
> **CellFormat** = `string` & `object`
|
|
35
59
|
|
|
36
|
-
Defined in: [src/models/Cell.ts:
|
|
60
|
+
Defined in: [src/models/Cell.ts:104](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L104)
|
|
37
61
|
|
|
38
62
|
Format to be applied to a cell value to convert it to text to display to the user.
|
|
39
63
|
|
|
@@ -53,7 +77,7 @@ Format to be applied to a cell value to convert it to text to display to the use
|
|
|
53
77
|
|
|
54
78
|
> **CellHorizontalAlignment** = `"General"` \| `"Left"` \| `"Center"` \| `"Right"` \| `"Fill"` \| `"Justify"` \| `"CenterAcrossSelection"` \| `"Distributed"`
|
|
55
79
|
|
|
56
|
-
Defined in: [src/models/Cell.ts:
|
|
80
|
+
Defined in: [src/models/Cell.ts:134](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L134)
|
|
57
81
|
|
|
58
82
|
***
|
|
59
83
|
|
|
@@ -61,7 +85,7 @@ Defined in: [src/models/Cell.ts:150](https://github.com/Future-Secure-AI/microso
|
|
|
61
85
|
|
|
62
86
|
> **CellScope** = `object`
|
|
63
87
|
|
|
64
|
-
Defined in: [src/models/Cell.ts:
|
|
88
|
+
Defined in: [src/models/Cell.ts:111](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L111)
|
|
65
89
|
|
|
66
90
|
The amount of detail that we're reading from a cell.
|
|
67
91
|
|
|
@@ -69,53 +93,13 @@ The amount of detail that we're reading from a cell.
|
|
|
69
93
|
|
|
70
94
|
| Property | Type | Description | Defined in |
|
|
71
95
|
| ------ | ------ | ------ | ------ |
|
|
72
|
-
| <a id="alignment"></a> `alignment` | `boolean` | Content position with the cell. VERY EXPENSIVE (+1 op per cell) | [src/models/Cell.ts:
|
|
73
|
-
| <a id="borders"></a> `borders` | `boolean` | Cell borders. VERY EXPENSIVE (+1 op per cell) | [src/models/Cell.ts:
|
|
74
|
-
| <a id="fill"></a> `fill` | `boolean` | Background fill style. VERY EXPENSIVE (+1 op per cell) | [src/models/Cell.ts:
|
|
75
|
-
| <a id="font"></a> `font` | `boolean` | Text style. VERY EXPENSIVE (+1 op per cell) | [src/models/Cell.ts:
|
|
76
|
-
| <a id="format-1"></a> `format` | `boolean` | Logic used to format values to text. CHEAP (
|
|
77
|
-
| <a id="text-1"></a> `text` | `boolean` | Formatted value, as presented to the user. CHEAP (
|
|
78
|
-
| <a id="values"></a> `values` | `boolean` | Raw cell value. CHEAP (
|
|
79
|
-
|
|
80
|
-
***
|
|
81
|
-
|
|
82
|
-
### CellStyle
|
|
83
|
-
|
|
84
|
-
> **CellStyle** = `object`
|
|
85
|
-
|
|
86
|
-
Defined in: [src/models/Cell.ts:61](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L61)
|
|
87
|
-
|
|
88
|
-
Style applied to the cell to affect its appearance, like color, borders, alignment, etc.
|
|
89
|
-
|
|
90
|
-
#### Properties
|
|
91
|
-
|
|
92
|
-
| Property | Type | Description | Defined in |
|
|
93
|
-
| ------ | ------ | ------ | ------ |
|
|
94
|
-
| <a id="alignment-1"></a> `alignment` | `object` | **`Experimental`** Alignment of cell contents. | [src/models/Cell.ts:75](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L75) |
|
|
95
|
-
| `alignment.horizontal?` | [`CellHorizontalAlignment`](#cellhorizontalalignment) | - | [src/models/Cell.ts:76](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L76) |
|
|
96
|
-
| `alignment.vertical?` | [`CellVerticalAlignment`](#cellverticalalignment) | - | [src/models/Cell.ts:77](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L77) |
|
|
97
|
-
| `alignment.wrapText?` | `boolean` | - | [src/models/Cell.ts:78](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L78) |
|
|
98
|
-
| <a id="borders-1"></a> `borders` | `object` | **`Experimental`** Borders around the cell. | [src/models/Cell.ts:84](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L84) |
|
|
99
|
-
| `borders.bottom?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:86](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L86) |
|
|
100
|
-
| `borders.diagonalDown?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:91](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L91) |
|
|
101
|
-
| `borders.diagonalUp?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:92](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L92) |
|
|
102
|
-
| `borders.insideHorizontal?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:90](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L90) |
|
|
103
|
-
| `borders.insideVertical?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:89](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L89) |
|
|
104
|
-
| `borders.left?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:87](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L87) |
|
|
105
|
-
| `borders.right?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:88](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L88) |
|
|
106
|
-
| `borders.top?` | [`Border`](Border.md#border) | - | [src/models/Cell.ts:85](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L85) |
|
|
107
|
-
| <a id="fill-1"></a> `fill` | `object` | **`Experimental`** Fill color of the cell. | [src/models/Cell.ts:107](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L107) |
|
|
108
|
-
| `fill.color?` | [`Color`](Color.md#color) | - | [src/models/Cell.ts:108](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L108) |
|
|
109
|
-
| <a id="font-1"></a> `font` | `object` | **`Experimental`** Font settings for the cell. | [src/models/Cell.ts:114](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L114) |
|
|
110
|
-
| `font.bold?` | `boolean` | - | [src/models/Cell.ts:118](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L118) |
|
|
111
|
-
| `font.color?` | [`Color`](Color.md#color) | - | [src/models/Cell.ts:117](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L117) |
|
|
112
|
-
| `font.italic?` | `boolean` | - | [src/models/Cell.ts:119](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L119) |
|
|
113
|
-
| `font.name?` | [`FontName`](FontName.md#fontname) | - | [src/models/Cell.ts:115](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L115) |
|
|
114
|
-
| `font.size?` | `number` | - | [src/models/Cell.ts:116](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L116) |
|
|
115
|
-
| `font.underline?` | [`CellUnderline`](#cellunderline) | - | [src/models/Cell.ts:120](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L120) |
|
|
116
|
-
| <a id="merge"></a> `merge` | `object` | **`Experimental`** Number of cell merges (WRITE ONLY). **Remarks** Due to API limitations, this value is never populated when reading a cell, but it can be set when writing a cell. | [src/models/Cell.ts:67](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L67) |
|
|
117
|
-
| `merge.down?` | `number` | - | [src/models/Cell.ts:69](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L69) |
|
|
118
|
-
| `merge.right?` | `number` | - | [src/models/Cell.ts:68](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L68) |
|
|
96
|
+
| <a id="alignment-1"></a> `alignment` | `boolean` | Content position with the cell. VERY EXPENSIVE (+1 op per cell) | [src/models/Cell.ts:122](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L122) |
|
|
97
|
+
| <a id="borders-1"></a> `borders` | `boolean` | Cell borders. VERY EXPENSIVE (+1 op per cell) | [src/models/Cell.ts:125](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L125) |
|
|
98
|
+
| <a id="fill-1"></a> `fill` | `boolean` | Background fill style. VERY EXPENSIVE (+1 op per cell) | [src/models/Cell.ts:128](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L128) |
|
|
99
|
+
| <a id="font-1"></a> `font` | `boolean` | Text style. VERY EXPENSIVE (+1 op per cell) | [src/models/Cell.ts:131](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L131) |
|
|
100
|
+
| <a id="format-1"></a> `format` | `boolean` | Logic used to format values to text. CHEAP (+1 op per 10K cells, no additional call op `values` or `text`) | [src/models/Cell.ts:119](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L119) |
|
|
101
|
+
| <a id="text-1"></a> `text` | `boolean` | Formatted value, as presented to the user. CHEAP (+1 op per 10K cells, no additional call op `values` or `format`) | [src/models/Cell.ts:116](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L116) |
|
|
102
|
+
| <a id="values"></a> `values` | `boolean` | Raw cell value. CHEAP (+1 op per 10K cells, no additional op with `text` or `format`) | [src/models/Cell.ts:113](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L113) |
|
|
119
103
|
|
|
120
104
|
***
|
|
121
105
|
|
|
@@ -123,7 +107,7 @@ Style applied to the cell to affect its appearance, like color, borders, alignme
|
|
|
123
107
|
|
|
124
108
|
> **CellText** = `string`
|
|
125
109
|
|
|
126
|
-
Defined in: [src/models/Cell.ts:
|
|
110
|
+
Defined in: [src/models/Cell.ts:98](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L98)
|
|
127
111
|
|
|
128
112
|
Text content of a cell in a worksheet.
|
|
129
113
|
|
|
@@ -137,7 +121,7 @@ This is a string that represents the text displayed in the cell, which may diffe
|
|
|
137
121
|
|
|
138
122
|
> **CellUnderline** = `"None"` \| `"Single"` \| `"Double"` \| `"SingleAccountant"` \| `"DoubleAccountant"`
|
|
139
123
|
|
|
140
|
-
Defined in: [src/models/Cell.ts:
|
|
124
|
+
Defined in: [src/models/Cell.ts:138](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L138)
|
|
141
125
|
|
|
142
126
|
***
|
|
143
127
|
|
|
@@ -145,7 +129,7 @@ Defined in: [src/models/Cell.ts:154](https://github.com/Future-Secure-AI/microso
|
|
|
145
129
|
|
|
146
130
|
> **CellValue** = `string` \| `number` \| `boolean`
|
|
147
131
|
|
|
148
|
-
Defined in: [src/models/Cell.ts:
|
|
132
|
+
Defined in: [src/models/Cell.ts:92](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L92)
|
|
149
133
|
|
|
150
134
|
CellValue represents the value of a cell in a spreadsheet.
|
|
151
135
|
|
|
@@ -159,4 +143,4 @@ CellValue represents the value of a cell in a spreadsheet.
|
|
|
159
143
|
|
|
160
144
|
> **CellVerticalAlignment** = `"Top"` \| `"Center"` \| `"Bottom"` \| `"Justify"` \| `"Distributed"`
|
|
161
145
|
|
|
162
|
-
Defined in: [src/models/Cell.ts:
|
|
146
|
+
Defined in: [src/models/Cell.ts:136](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Cell.ts#L136)
|
package/docs/api/CellFormat.md
CHANGED
|
@@ -10,7 +10,7 @@ Cell utilities.
|
|
|
10
10
|
|
|
11
11
|
> `const` **accountingCellFormat**: [`CellFormat`](Cell.md#cellformat-1)
|
|
12
12
|
|
|
13
|
-
Defined in: src/services/cell.ts:12
|
|
13
|
+
Defined in: [src/services/cell.ts:12](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/cell.ts#L12)
|
|
14
14
|
|
|
15
15
|
***
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@ Defined in: src/services/cell.ts:12
|
|
|
18
18
|
|
|
19
19
|
> `const` **defaultCellScope**: [`CellScope`](Cell.md#cellscope)
|
|
20
20
|
|
|
21
|
-
Defined in: src/services/cell.ts:18
|
|
21
|
+
Defined in: [src/services/cell.ts:18](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/cell.ts#L18)
|
|
22
22
|
|
|
23
23
|
***
|
|
24
24
|
|
|
@@ -26,7 +26,7 @@ Defined in: src/services/cell.ts:18
|
|
|
26
26
|
|
|
27
27
|
> `const` **generalCellFormat**: [`CellFormat`](Cell.md#cellformat-1)
|
|
28
28
|
|
|
29
|
-
Defined in: src/services/cell.ts:9
|
|
29
|
+
Defined in: [src/services/cell.ts:9](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/cell.ts#L9)
|
|
30
30
|
|
|
31
31
|
***
|
|
32
32
|
|
|
@@ -34,7 +34,7 @@ Defined in: src/services/cell.ts:9
|
|
|
34
34
|
|
|
35
35
|
> `const` **numberCellFormat**: [`CellFormat`](Cell.md#cellformat-1)
|
|
36
36
|
|
|
37
|
-
Defined in: src/services/cell.ts:11
|
|
37
|
+
Defined in: [src/services/cell.ts:11](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/cell.ts#L11)
|
|
38
38
|
|
|
39
39
|
***
|
|
40
40
|
|
|
@@ -42,4 +42,4 @@ Defined in: src/services/cell.ts:11
|
|
|
42
42
|
|
|
43
43
|
> `const` **textCellFormat**: [`CellFormat`](Cell.md#cellformat-1)
|
|
44
44
|
|
|
45
|
-
Defined in: src/services/cell.ts:10
|
|
45
|
+
Defined in: [src/services/cell.ts:10](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/cell.ts#L10)
|
package/docs/api/README.md
CHANGED
|
@@ -156,6 +156,8 @@
|
|
|
156
156
|
| [createWorkbookAndStartSession](createWorkbookAndStartSession.md) | Create a new workbook and open a session for that workbook. |
|
|
157
157
|
| [downloadDriveItemContent](downloadDriveItemContent.md) | Download a drive item and save it to the local disk. |
|
|
158
158
|
| [getWorkbookWorksheetByName](getWorkbookWorksheetByName-1.md) | Get a worksheet by its name. |
|
|
159
|
+
| [insertRow](insertRow.md) | Inserts a single row into a workbook range. |
|
|
160
|
+
| [insertRows](insertRows.md) | Inserts rows into a workbook range. |
|
|
159
161
|
| [iterateRows](iterateRows.md) | Iterate over the rows in a given worksheet range. |
|
|
160
162
|
| [listDriveItems](listDriveItems.md) | List drive items in a drive or a drive item. |
|
|
161
163
|
| [readFirstRow](readFirstRow.md) | Read the first row from a given workbook range. |
|
|
@@ -167,4 +169,6 @@
|
|
|
167
169
|
| [setWorkbookTableBodyVisibleRows](setWorkbookTableBodyVisibleRows.md) | Set visible rows of a workbook table with the provided 2D array of values, ignoring hidden rows and inserting new rows at the end if needed. |
|
|
168
170
|
| [tryCloseWorkbookSession](tryCloseWorkbookSession.md) | Try and close a workbook session. |
|
|
169
171
|
| [tryDeleteDriveItem](tryDeleteDriveItem.md) | Attempts to delete a drive item, returning success status. |
|
|
172
|
+
| [updateFirstRow](updateFirstRow.md) | Update first row in a given workbook range. |
|
|
173
|
+
| [updateRows](updateRows.md) | Update rows in a given workbook range. |
|
|
170
174
|
| [writeWorkbookRows](writeWorkbookRows.md) | Write rows to a workbook range. |
|
|
@@ -10,7 +10,7 @@ Retrieve the format of a workbook range.
|
|
|
10
10
|
|
|
11
11
|
> **getWorkbookRangeFormat**(`rangeRef`): [`GraphOperation`](GraphOperation.md#graphoperation)\<`WorkbookRangeFormat` & [`SiteRef`](Site-1.md#siteref) & `object` & `object` & `object` & `object` & `object`\>
|
|
12
12
|
|
|
13
|
-
Defined in: [src/operations/workbookRange/getWorkbookRangeFormat.ts:
|
|
13
|
+
Defined in: [src/operations/workbookRange/getWorkbookRangeFormat.ts:21](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/workbookRange/getWorkbookRangeFormat.ts#L21)
|
|
14
14
|
|
|
15
15
|
Retrieve the format of a workbook range.
|
|
16
16
|
|
|
@@ -10,7 +10,7 @@ Fetch a range.
|
|
|
10
10
|
|
|
11
11
|
> **getWorkbookWorksheetRange**(`rangeRef`, `select?`): [`GraphOperation`](GraphOperation.md#graphoperation)\<`WorkbookRange` & [`SiteRef`](Site-1.md#siteref) & `object` & `object` & `object` & `object` & `object`\>
|
|
12
12
|
|
|
13
|
-
Defined in: [src/operations/workbookRange/getWorkbookWorksheetRange.ts:
|
|
13
|
+
Defined in: [src/operations/workbookRange/getWorkbookWorksheetRange.ts:23](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/workbookRange/getWorkbookWorksheetRange.ts#L23)
|
|
14
14
|
|
|
15
15
|
Fetch a range.
|
|
16
16
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[Microsoft Graph SDK](README.md) / insertRow
|
|
2
|
+
|
|
3
|
+
# insertRow
|
|
4
|
+
|
|
5
|
+
**`Experimental`**
|
|
6
|
+
|
|
7
|
+
Inserts a single row into a workbook range.
|
|
8
|
+
|
|
9
|
+
## Functions
|
|
10
|
+
|
|
11
|
+
### insertWorkbookRangeRow()
|
|
12
|
+
|
|
13
|
+
> **insertWorkbookRangeRow**(`originRef`, `row`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>
|
|
14
|
+
|
|
15
|
+
Defined in: [src/tasks/insertWorkbookRangeRow.ts:20](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/tasks/insertWorkbookRangeRow.ts#L20)
|
|
16
|
+
|
|
17
|
+
**`Experimental`**
|
|
18
|
+
|
|
19
|
+
#### Parameters
|
|
20
|
+
|
|
21
|
+
| Parameter | Type | Description |
|
|
22
|
+
| ------ | ------ | ------ |
|
|
23
|
+
| `originRef` | [`WorkbookRangeRef`](WorkbookRange-1.md#workbookrangeref) | Reference to the workbook range to update. Only the upper-left cell is used as an origin point. |
|
|
24
|
+
| `row` | [`Partial`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)\<[`Cell`](Cell.md#cell)\>[] | Array of cells to insert as a single row. |
|
|
25
|
+
|
|
26
|
+
#### Returns
|
|
27
|
+
|
|
28
|
+
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>
|
|
29
|
+
|
|
30
|
+
#### Example
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
await insertRow(originRef, [{ value: "A1" }, { value: "B1" }, { value: "C1" }]);
|
|
34
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[Microsoft Graph SDK](README.md) / insertRows
|
|
2
|
+
|
|
3
|
+
# insertRows
|
|
4
|
+
|
|
5
|
+
**`Experimental`**
|
|
6
|
+
|
|
7
|
+
Inserts rows into a workbook range.
|
|
8
|
+
|
|
9
|
+
## Functions
|
|
10
|
+
|
|
11
|
+
### insertWorkbookRangeRows()
|
|
12
|
+
|
|
13
|
+
> **insertWorkbookRangeRows**(`originRef`, `cells`, `maxCellsPerOperation`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>
|
|
14
|
+
|
|
15
|
+
Defined in: [src/tasks/insertWorkbookRangeRows.ts:38](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/tasks/insertWorkbookRangeRows.ts#L38)
|
|
16
|
+
|
|
17
|
+
**`Experimental`**
|
|
18
|
+
|
|
19
|
+
#### Parameters
|
|
20
|
+
|
|
21
|
+
| Parameter | Type | Default value | Description |
|
|
22
|
+
| ------ | ------ | ------ | ------ |
|
|
23
|
+
| `originRef` | [`WorkbookRangeRef`](WorkbookRange-1.md#workbookrangeref) | `undefined` | Reference to the workbook range to update. Only the upper-left cell is used as an origin point. |
|
|
24
|
+
| `cells` | [`Iterable`](https://www.typescriptlang.org/docs/handbook/iterators-and-generators.html#iterable-interface)\<[`Partial`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)\<[`Cell`](Cell.md#cell)\>[], `any`, `any`\> \| `AsyncIterable`\<[`Partial`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)\<[`Cell`](Cell.md#cell)\>[], `any`, `any`\> | `undefined` | Array of arrays of cells to update in the specified range. |
|
|
25
|
+
| `maxCellsPerOperation` | `null` \| `number` | `null` | Prescribe max cells to retrieve per operation. `null` automatically determines value. DO NOT SET EXCEPT FOR ADVANCED TUNING. |
|
|
26
|
+
|
|
27
|
+
#### Returns
|
|
28
|
+
|
|
29
|
+
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>
|
|
30
|
+
|
|
31
|
+
#### Example
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
// Basic example:
|
|
35
|
+
await insertRows(originRef, [
|
|
36
|
+
[{ value: "A1" }, { value: "B1" }, { value: "C1" }],
|
|
37
|
+
[{ value: "A2" }, { value: "B2" }, { value: "C2" }],
|
|
38
|
+
[{ value: "A3" }, { value: "B3" }, { value: "C3" }],
|
|
39
|
+
])
|
|
40
|
+
|
|
41
|
+
// Advanced example with cell formatting:
|
|
42
|
+
await insertRows(originRef, [
|
|
43
|
+
[{ value: "A1", format: { fontColor: "red" } }, { value: "B1" }, { value: "C1" }],
|
|
44
|
+
[{ value: "A2" }, { value: "B2", format: { fontColor: "blue" } }, { value: "C2" }],
|
|
45
|
+
[{ value: "A3" }, { value: "B3" }, { value: "C3", format: { fontColor: "green" } }],
|
|
46
|
+
]);
|
|
47
|
+
```
|