google-spreadsheet 5.0.1 → 5.0.3
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/README.md +1 -1
- package/dist/index.cjs +1382 -4016
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +757 -1430
- package/dist/index.d.ts +757 -1430
- package/dist/index.js +1356 -4017
- package/dist/index.js.map +1 -1
- package/package.json +23 -26
- package/src/lib/GoogleSpreadsheet.ts +21 -9
- package/src/lib/GoogleSpreadsheetWorksheet.ts +67 -17
- package/src/lib/types/sheets-types.ts +35 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,673 +1,60 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
5
|
-
type LiteralUnion<LiteralType extends BaseType, BaseType extends Primitive> = LiteralType | (BaseType & {
|
|
6
|
-
_?: never;
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
type KyResponse<T = unknown> = {
|
|
10
|
-
json: <J = T>() => Promise<J>;
|
|
11
|
-
} & Response;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
Returns a `Response` object with `Body` methods added for convenience. So you can, for example, call `ky.get(input).json()` directly without having to await the `Response` first. When called like that, an appropriate `Accept` header will be set depending on the body method used. Unlike the `Body` methods of `window.Fetch`; these will throw an `HTTPError` if the response status is not in the range of `200...299`. Also, `.json()` will return an empty string if body is empty or the response status is `204` instead of throwing a parse error due to an empty body.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
type ResponsePromise<T = unknown> = {
|
|
18
|
-
arrayBuffer: () => Promise<ArrayBuffer>;
|
|
19
|
-
blob: () => Promise<Blob>;
|
|
20
|
-
formData: () => Promise<FormData>;
|
|
21
|
-
/**
|
|
22
|
-
Get the response body as JSON.
|
|
23
|
-
|
|
24
|
-
@example
|
|
25
|
-
```
|
|
26
|
-
import ky from 'ky';
|
|
27
|
-
|
|
28
|
-
const json = await ky(…).json();
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
@example
|
|
32
|
-
```
|
|
33
|
-
import ky from 'ky';
|
|
34
|
-
|
|
35
|
-
interface Result {
|
|
36
|
-
value: number;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const result1 = await ky(…).json<Result>();
|
|
40
|
-
// or
|
|
41
|
-
const result2 = await ky<Result>(…).json();
|
|
42
|
-
```
|
|
43
|
-
*/
|
|
44
|
-
json: <J = T>() => Promise<J>;
|
|
45
|
-
text: () => Promise<string>;
|
|
46
|
-
} & Promise<KyResponse<T>>;
|
|
47
|
-
|
|
48
|
-
type KyRequest<T = unknown> = {
|
|
49
|
-
json: <J = T>() => Promise<J>;
|
|
50
|
-
} & Request;
|
|
51
|
-
|
|
52
|
-
declare class HTTPError<T = unknown> extends Error {
|
|
53
|
-
response: KyResponse<T>;
|
|
54
|
-
request: KyRequest;
|
|
55
|
-
options: NormalizedOptions;
|
|
56
|
-
constructor(response: Response, request: Request, options: NormalizedOptions);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
type BeforeRequestHook = (request: KyRequest, options: NormalizedOptions) => Request | Response | void | Promise<Request | Response | void>;
|
|
60
|
-
type BeforeRetryState = {
|
|
61
|
-
request: KyRequest;
|
|
62
|
-
options: NormalizedOptions;
|
|
63
|
-
error: Error;
|
|
64
|
-
retryCount: number;
|
|
65
|
-
};
|
|
66
|
-
type BeforeRetryHook = (options: BeforeRetryState) => typeof stop | void | Promise<typeof stop | void>;
|
|
67
|
-
type AfterResponseHook = (request: KyRequest, options: NormalizedOptions, response: KyResponse) => Response | void | Promise<Response | void>;
|
|
68
|
-
type BeforeErrorHook = (error: HTTPError) => HTTPError | Promise<HTTPError>;
|
|
69
|
-
type Hooks = {
|
|
70
|
-
/**
|
|
71
|
-
This hook enables you to modify the request right before it is sent. Ky will make no further changes to the request after this. The hook function receives normalized input and options as arguments. You could, for example, modify `options.headers` here.
|
|
72
|
-
|
|
73
|
-
A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) can be returned from this hook to completely avoid making a HTTP request. This can be used to mock a request, check an internal cache, etc. An **important** consideration when returning a `Response` from this hook is that all the following hooks will be skipped, so **ensure you only return a `Response` from the last hook**.
|
|
74
|
-
|
|
75
|
-
@default []
|
|
76
|
-
*/
|
|
77
|
-
beforeRequest?: BeforeRequestHook[];
|
|
78
|
-
/**
|
|
79
|
-
This hook enables you to modify the request right before retry. Ky will make no further changes to the request after this. The hook function receives an object with the normalized request and options, an error instance, and the retry count. You could, for example, modify `request.headers` here.
|
|
80
|
-
|
|
81
|
-
If the request received a response, the error will be of type `HTTPError` and the `Response` object will be available at `error.response`. Be aware that some types of errors, such as network errors, inherently mean that a response was not received. In that case, the error will not be an instance of `HTTPError`.
|
|
82
|
-
|
|
83
|
-
You can prevent Ky from retrying the request by throwing an error. Ky will not handle it in any way and the error will be propagated to the request initiator. The rest of the `beforeRetry` hooks will not be called in this case. Alternatively, you can return the [`ky.stop`](#ky.stop) symbol to do the same thing but without propagating an error (this has some limitations, see `ky.stop` docs for details).
|
|
84
|
-
|
|
85
|
-
@example
|
|
86
|
-
```
|
|
87
|
-
import ky from 'ky';
|
|
88
|
-
|
|
89
|
-
const response = await ky('https://example.com', {
|
|
90
|
-
hooks: {
|
|
91
|
-
beforeRetry: [
|
|
92
|
-
async ({request, options, error, retryCount}) => {
|
|
93
|
-
const token = await ky('https://example.com/refresh-token');
|
|
94
|
-
options.headers.set('Authorization', `token ${token}`);
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
@default []
|
|
102
|
-
*/
|
|
103
|
-
beforeRetry?: BeforeRetryHook[];
|
|
104
|
-
/**
|
|
105
|
-
This hook enables you to read and optionally modify the response. The hook function receives normalized input, options, and a clone of the response as arguments. The return value of the hook function will be used by Ky as the response object if it's an instance of [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response).
|
|
106
|
-
|
|
107
|
-
@default []
|
|
108
|
-
|
|
109
|
-
@example
|
|
110
|
-
```
|
|
111
|
-
import ky from 'ky';
|
|
112
|
-
|
|
113
|
-
const response = await ky('https://example.com', {
|
|
114
|
-
hooks: {
|
|
115
|
-
afterResponse: [
|
|
116
|
-
(_input, _options, response) => {
|
|
117
|
-
// You could do something with the response, for example, logging.
|
|
118
|
-
log(response);
|
|
119
|
-
|
|
120
|
-
// Or return a `Response` instance to overwrite the response.
|
|
121
|
-
return new Response('A different response', {status: 200});
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
// Or retry with a fresh token on a 403 error
|
|
125
|
-
async (input, options, response) => {
|
|
126
|
-
if (response.status === 403) {
|
|
127
|
-
// Get a fresh token
|
|
128
|
-
const token = await ky('https://example.com/token').text();
|
|
129
|
-
|
|
130
|
-
// Retry with the token
|
|
131
|
-
options.headers.set('Authorization', `token ${token}`);
|
|
132
|
-
|
|
133
|
-
return ky(input, options);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
```
|
|
140
|
-
*/
|
|
141
|
-
afterResponse?: AfterResponseHook[];
|
|
142
|
-
/**
|
|
143
|
-
This hook enables you to modify the `HTTPError` right before it is thrown. The hook function receives a `HTTPError` as an argument and should return an instance of `HTTPError`.
|
|
144
|
-
|
|
145
|
-
@default []
|
|
146
|
-
|
|
147
|
-
@example
|
|
148
|
-
```
|
|
149
|
-
import ky from 'ky';
|
|
150
|
-
|
|
151
|
-
await ky('https://example.com', {
|
|
152
|
-
hooks: {
|
|
153
|
-
beforeError: [
|
|
154
|
-
error => {
|
|
155
|
-
const {response} = error;
|
|
156
|
-
if (response && response.body) {
|
|
157
|
-
error.name = 'GitHubError';
|
|
158
|
-
error.message = `${response.body.message} (${response.status})`;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return error;
|
|
162
|
-
}
|
|
163
|
-
]
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
```
|
|
167
|
-
*/
|
|
168
|
-
beforeError?: BeforeErrorHook[];
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
type RetryOptions = {
|
|
172
|
-
/**
|
|
173
|
-
The number of times to retry failed requests.
|
|
174
|
-
|
|
175
|
-
@default 2
|
|
176
|
-
*/
|
|
177
|
-
limit?: number;
|
|
178
|
-
/**
|
|
179
|
-
The HTTP methods allowed to retry.
|
|
180
|
-
|
|
181
|
-
@default ['get', 'put', 'head', 'delete', 'options', 'trace']
|
|
182
|
-
*/
|
|
183
|
-
methods?: string[];
|
|
184
|
-
/**
|
|
185
|
-
The HTTP status codes allowed to retry.
|
|
186
|
-
|
|
187
|
-
@default [408, 413, 429, 500, 502, 503, 504]
|
|
188
|
-
*/
|
|
189
|
-
statusCodes?: number[];
|
|
190
|
-
/**
|
|
191
|
-
The HTTP status codes allowed to retry with a `Retry-After` header.
|
|
192
|
-
|
|
193
|
-
@default [413, 429, 503]
|
|
194
|
-
*/
|
|
195
|
-
afterStatusCodes?: number[];
|
|
196
|
-
/**
|
|
197
|
-
If the `Retry-After` header is greater than `maxRetryAfter`, the request will be canceled.
|
|
198
|
-
|
|
199
|
-
@default Infinity
|
|
200
|
-
*/
|
|
201
|
-
maxRetryAfter?: number;
|
|
202
|
-
/**
|
|
203
|
-
The upper limit of the delay per retry in milliseconds.
|
|
204
|
-
To clamp the delay, set `backoffLimit` to 1000, for example.
|
|
205
|
-
|
|
206
|
-
By default, the delay is calculated in the following way:
|
|
207
|
-
|
|
208
|
-
```
|
|
209
|
-
0.3 * (2 ** (attemptCount - 1)) * 1000
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
The delay increases exponentially.
|
|
213
|
-
|
|
214
|
-
@default Infinity
|
|
215
|
-
*/
|
|
216
|
-
backoffLimit?: number;
|
|
217
|
-
/**
|
|
218
|
-
A function to calculate the delay between retries given `attemptCount` (starts from 1).
|
|
219
|
-
|
|
220
|
-
@default attemptCount => 0.3 * (2 ** (attemptCount - 1)) * 1000
|
|
221
|
-
*/
|
|
222
|
-
delay?: (attemptCount: number) => number;
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
type SearchParamsInit = string | string[][] | Record<string, string> | URLSearchParams | undefined;
|
|
226
|
-
type SearchParamsOption = SearchParamsInit | Record<string, string | number | boolean> | Array<Array<string | number | boolean>>;
|
|
227
|
-
type HttpMethod = 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete';
|
|
228
|
-
type Input = string | URL | Request;
|
|
229
|
-
type Progress = {
|
|
230
|
-
percent: number;
|
|
231
|
-
transferredBytes: number;
|
|
232
|
-
/**
|
|
233
|
-
Note: If it's not possible to retrieve the body size, it will be `0`.
|
|
234
|
-
*/
|
|
235
|
-
totalBytes: number;
|
|
236
|
-
};
|
|
237
|
-
type KyHeadersInit = NonNullable<RequestInit['headers']> | Record<string, string | undefined>;
|
|
238
|
-
/**
|
|
239
|
-
Custom Ky options
|
|
240
|
-
*/
|
|
241
|
-
type KyOptions = {
|
|
242
|
-
/**
|
|
243
|
-
Shortcut for sending JSON. Use this instead of the `body` option.
|
|
244
|
-
|
|
245
|
-
Accepts any plain object or value, which will be `JSON.stringify()`'d and sent in the body with the correct header set.
|
|
246
|
-
*/
|
|
247
|
-
json?: unknown;
|
|
248
|
-
/**
|
|
249
|
-
User-defined JSON-parsing function.
|
|
250
|
-
|
|
251
|
-
Use-cases:
|
|
252
|
-
1. Parse JSON via the [`bourne` package](https://github.com/hapijs/bourne) to protect from prototype pollution.
|
|
253
|
-
2. Parse JSON with [`reviver` option of `JSON.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse).
|
|
254
|
-
|
|
255
|
-
@default JSON.parse()
|
|
256
|
-
|
|
257
|
-
@example
|
|
258
|
-
```
|
|
259
|
-
import ky from 'ky';
|
|
260
|
-
import bourne from '@hapijs/bourne';
|
|
261
|
-
|
|
262
|
-
const json = await ky('https://example.com', {
|
|
263
|
-
parseJson: text => bourne(text)
|
|
264
|
-
}).json();
|
|
265
|
-
```
|
|
266
|
-
*/
|
|
267
|
-
parseJson?: (text: string) => unknown;
|
|
268
|
-
/**
|
|
269
|
-
User-defined JSON-stringifying function.
|
|
270
|
-
|
|
271
|
-
Use-cases:
|
|
272
|
-
1. Stringify JSON with a custom `replacer` function.
|
|
273
|
-
|
|
274
|
-
@default JSON.stringify()
|
|
275
|
-
|
|
276
|
-
@example
|
|
277
|
-
```
|
|
278
|
-
import ky from 'ky';
|
|
279
|
-
import {DateTime} from 'luxon';
|
|
280
|
-
|
|
281
|
-
const json = await ky('https://example.com', {
|
|
282
|
-
stringifyJson: data => JSON.stringify(data, (key, value) => {
|
|
283
|
-
if (key.endsWith('_at')) {
|
|
284
|
-
return DateTime.fromISO(value).toSeconds();
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
return value;
|
|
288
|
-
})
|
|
289
|
-
}).json();
|
|
290
|
-
```
|
|
291
|
-
*/
|
|
292
|
-
stringifyJson?: (data: unknown) => string;
|
|
293
|
-
/**
|
|
294
|
-
Search parameters to include in the request URL. Setting this will override all existing search parameters in the input URL.
|
|
295
|
-
|
|
296
|
-
Accepts any value supported by [`URLSearchParams()`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/URLSearchParams).
|
|
297
|
-
*/
|
|
298
|
-
searchParams?: SearchParamsOption;
|
|
299
|
-
/**
|
|
300
|
-
A prefix to prepend to the `input` URL when making the request. It can be any valid URL, either relative or absolute. A trailing slash `/` is optional and will be added automatically, if needed, when it is joined with `input`. Only takes effect when `input` is a string. The `input` argument cannot start with a slash `/` when using this option.
|
|
301
|
-
|
|
302
|
-
Useful when used with [`ky.extend()`](#kyextenddefaultoptions) to create niche-specific Ky-instances.
|
|
303
|
-
|
|
304
|
-
Notes:
|
|
305
|
-
- After `prefixUrl` and `input` are joined, the result is resolved against the [base URL](https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI) of the page (if any).
|
|
306
|
-
- Leading slashes in `input` are disallowed when using this option to enforce consistency and avoid confusion about how the `input` URL is handled, given that `input` will not follow the normal URL resolution rules when `prefixUrl` is being used, which changes the meaning of a leading slash.
|
|
307
|
-
|
|
308
|
-
@example
|
|
309
|
-
```
|
|
310
|
-
import ky from 'ky';
|
|
311
|
-
|
|
312
|
-
// On https://example.com
|
|
313
|
-
|
|
314
|
-
const response = await ky('unicorn', {prefixUrl: '/api'});
|
|
315
|
-
//=> 'https://example.com/api/unicorn'
|
|
316
|
-
|
|
317
|
-
const response = await ky('unicorn', {prefixUrl: 'https://cats.com'});
|
|
318
|
-
//=> 'https://cats.com/unicorn'
|
|
319
|
-
```
|
|
320
|
-
*/
|
|
321
|
-
prefixUrl?: URL | string;
|
|
322
|
-
/**
|
|
323
|
-
An object representing `limit`, `methods`, `statusCodes`, `afterStatusCodes`, and `maxRetryAfter` fields for maximum retry count, allowed methods, allowed status codes, status codes allowed to use the [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) time, and maximum [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) time.
|
|
324
|
-
|
|
325
|
-
If `retry` is a number, it will be used as `limit` and other defaults will remain in place.
|
|
326
|
-
|
|
327
|
-
If the response provides an HTTP status contained in `afterStatusCodes`, Ky will wait until the date or timeout given in the [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header has passed to retry the request. If `Retry-After` is missing, the non-standard [`RateLimit-Reset`](https://www.ietf.org/archive/id/draft-polli-ratelimit-headers-02.html#section-3.3) header is used in its place as a fallback. If the provided status code is not in the list, the [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header will be ignored.
|
|
328
|
-
|
|
329
|
-
If `maxRetryAfter` is set to `undefined`, it will use `options.timeout`. If [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header is greater than `maxRetryAfter`, it will cancel the request.
|
|
330
|
-
|
|
331
|
-
By default, delays between retries are calculated with the function `0.3 * (2 ** (attemptCount - 1)) * 1000`, where `attemptCount` is the attempt number (starts from 1), however this can be changed by passing a `delay` function.
|
|
332
|
-
|
|
333
|
-
Retries are not triggered following a timeout.
|
|
334
|
-
|
|
335
|
-
@example
|
|
336
|
-
```
|
|
337
|
-
import ky from 'ky';
|
|
338
|
-
|
|
339
|
-
const json = await ky('https://example.com', {
|
|
340
|
-
retry: {
|
|
341
|
-
limit: 10,
|
|
342
|
-
methods: ['get'],
|
|
343
|
-
statusCodes: [413]
|
|
344
|
-
}
|
|
345
|
-
}).json();
|
|
346
|
-
```
|
|
347
|
-
*/
|
|
348
|
-
retry?: RetryOptions | number;
|
|
349
|
-
/**
|
|
350
|
-
Timeout in milliseconds for getting a response, including any retries. Can not be greater than 2147483647.
|
|
351
|
-
If set to `false`, there will be no timeout.
|
|
352
|
-
|
|
353
|
-
@default 10000
|
|
354
|
-
*/
|
|
355
|
-
timeout?: number | false;
|
|
356
|
-
/**
|
|
357
|
-
Hooks allow modifications during the request lifecycle. Hook functions may be async and are run serially.
|
|
358
|
-
*/
|
|
359
|
-
hooks?: Hooks;
|
|
360
|
-
/**
|
|
361
|
-
Throw an `HTTPError` when, after following redirects, the response has a non-2xx status code. To also throw for redirects instead of following them, set the [`redirect`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters) option to `'manual'`.
|
|
362
|
-
|
|
363
|
-
Setting this to `false` may be useful if you are checking for resource availability and are expecting error responses.
|
|
364
|
-
|
|
365
|
-
Note: If `false`, error responses are considered successful and the request will not be retried.
|
|
366
|
-
|
|
367
|
-
@default true
|
|
368
|
-
*/
|
|
369
|
-
throwHttpErrors?: boolean;
|
|
370
|
-
/**
|
|
371
|
-
Download progress event handler.
|
|
372
|
-
|
|
373
|
-
@param progress - Object containing download progress information.
|
|
374
|
-
@param chunk - Data that was received. Note: It's empty for the first call.
|
|
375
|
-
|
|
376
|
-
@example
|
|
377
|
-
```
|
|
378
|
-
import ky from 'ky';
|
|
379
|
-
|
|
380
|
-
const response = await ky('https://example.com', {
|
|
381
|
-
onDownloadProgress: (progress, chunk) => {
|
|
382
|
-
// Example output:
|
|
383
|
-
// `0% - 0 of 1271 bytes`
|
|
384
|
-
// `100% - 1271 of 1271 bytes`
|
|
385
|
-
console.log(`${progress.percent * 100}% - ${progress.transferredBytes} of ${progress.totalBytes} bytes`);
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
```
|
|
389
|
-
*/
|
|
390
|
-
onDownloadProgress?: (progress: Progress, chunk: Uint8Array) => void;
|
|
391
|
-
/**
|
|
392
|
-
Upload progress event handler.
|
|
393
|
-
|
|
394
|
-
@param progress - Object containing upload progress information.
|
|
395
|
-
@param chunk - Data that was sent. Note: It's empty for the last call.
|
|
396
|
-
|
|
397
|
-
@example
|
|
398
|
-
```
|
|
399
|
-
import ky from 'ky';
|
|
400
|
-
|
|
401
|
-
const response = await ky.post('https://example.com/upload', {
|
|
402
|
-
body: largeFile,
|
|
403
|
-
onUploadProgress: (progress, chunk) => {
|
|
404
|
-
// Example output:
|
|
405
|
-
// `0% - 0 of 1271 bytes`
|
|
406
|
-
// `100% - 1271 of 1271 bytes`
|
|
407
|
-
console.log(`${progress.percent * 100}% - ${progress.transferredBytes} of ${progress.totalBytes} bytes`);
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
```
|
|
411
|
-
*/
|
|
412
|
-
onUploadProgress?: (progress: Progress, chunk: Uint8Array) => void;
|
|
413
|
-
/**
|
|
414
|
-
User-defined `fetch` function.
|
|
415
|
-
Has to be fully compatible with the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) standard.
|
|
416
|
-
|
|
417
|
-
Use-cases:
|
|
418
|
-
1. Use custom `fetch` implementations like [`isomorphic-unfetch`](https://www.npmjs.com/package/isomorphic-unfetch).
|
|
419
|
-
2. Use the `fetch` wrapper function provided by some frameworks that use server-side rendering (SSR).
|
|
420
|
-
|
|
421
|
-
@default fetch
|
|
422
|
-
|
|
423
|
-
@example
|
|
424
|
-
```
|
|
425
|
-
import ky from 'ky';
|
|
426
|
-
import fetch from 'isomorphic-unfetch';
|
|
427
|
-
|
|
428
|
-
const json = await ky('https://example.com', {fetch}).json();
|
|
429
|
-
```
|
|
430
|
-
*/
|
|
431
|
-
fetch?: (input: Input, init?: RequestInit) => Promise<Response>;
|
|
432
|
-
};
|
|
433
|
-
/**
|
|
434
|
-
Options are the same as `window.fetch`, except for the KyOptions
|
|
435
|
-
*/
|
|
436
|
-
interface Options extends KyOptions, Omit<RequestInit, 'headers'> {
|
|
437
|
-
/**
|
|
438
|
-
HTTP method used to make the request.
|
|
439
|
-
|
|
440
|
-
Internally, the standard methods (`GET`, `POST`, `PUT`, `PATCH`, `HEAD` and `DELETE`) are uppercased in order to avoid server errors due to case sensitivity.
|
|
441
|
-
*/
|
|
442
|
-
method?: LiteralUnion<HttpMethod, string>;
|
|
443
|
-
/**
|
|
444
|
-
HTTP headers used to make the request.
|
|
445
|
-
|
|
446
|
-
You can pass a `Headers` instance or a plain object.
|
|
447
|
-
|
|
448
|
-
You can remove a header with `.extend()` by passing the header with an `undefined` value.
|
|
449
|
-
|
|
450
|
-
@example
|
|
451
|
-
```
|
|
452
|
-
import ky from 'ky';
|
|
453
|
-
|
|
454
|
-
const url = 'https://sindresorhus.com';
|
|
455
|
-
|
|
456
|
-
const original = ky.create({
|
|
457
|
-
headers: {
|
|
458
|
-
rainbow: 'rainbow',
|
|
459
|
-
unicorn: 'unicorn'
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
const extended = original.extend({
|
|
464
|
-
headers: {
|
|
465
|
-
rainbow: undefined
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
|
|
469
|
-
const response = await extended(url).json();
|
|
470
|
-
|
|
471
|
-
console.log('rainbow' in response);
|
|
472
|
-
//=> false
|
|
473
|
-
|
|
474
|
-
console.log('unicorn' in response);
|
|
475
|
-
//=> true
|
|
476
|
-
```
|
|
477
|
-
*/
|
|
478
|
-
headers?: KyHeadersInit;
|
|
479
|
-
}
|
|
480
|
-
/**
|
|
481
|
-
Normalized options passed to the `fetch` call and the `beforeRequest` hooks.
|
|
482
|
-
*/
|
|
483
|
-
interface NormalizedOptions extends RequestInit {
|
|
484
|
-
method: NonNullable<RequestInit['method']>;
|
|
485
|
-
credentials?: NonNullable<RequestInit['credentials']>;
|
|
486
|
-
retry: RetryOptions;
|
|
487
|
-
prefixUrl: string;
|
|
488
|
-
onDownloadProgress: Options['onDownloadProgress'];
|
|
489
|
-
onUploadProgress: Options['onUploadProgress'];
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
declare const stop: unique symbol;
|
|
493
|
-
|
|
494
|
-
type KyInstance = {
|
|
495
|
-
/**
|
|
496
|
-
Fetch the given `url`.
|
|
497
|
-
|
|
498
|
-
@param url - `Request` object, `URL` object, or URL string.
|
|
499
|
-
@returns A promise with `Body` method added.
|
|
500
|
-
|
|
501
|
-
@example
|
|
502
|
-
```
|
|
503
|
-
import ky from 'ky';
|
|
504
|
-
|
|
505
|
-
const json = await ky('https://example.com', {json: {foo: true}}).json();
|
|
506
|
-
|
|
507
|
-
console.log(json);
|
|
508
|
-
//=> `{data: '🦄'}`
|
|
509
|
-
```
|
|
510
|
-
*/
|
|
511
|
-
<T>(url: Input, options?: Options): ResponsePromise<T>;
|
|
512
|
-
/**
|
|
513
|
-
Fetch the given `url` using the option `{method: 'get'}`.
|
|
514
|
-
|
|
515
|
-
@param url - `Request` object, `URL` object, or URL string.
|
|
516
|
-
@returns A promise with `Body` methods added.
|
|
517
|
-
*/
|
|
518
|
-
get: <T>(url: Input, options?: Options) => ResponsePromise<T>;
|
|
519
|
-
/**
|
|
520
|
-
Fetch the given `url` using the option `{method: 'post'}`.
|
|
521
|
-
|
|
522
|
-
@param url - `Request` object, `URL` object, or URL string.
|
|
523
|
-
@returns A promise with `Body` methods added.
|
|
524
|
-
*/
|
|
525
|
-
post: <T>(url: Input, options?: Options) => ResponsePromise<T>;
|
|
526
|
-
/**
|
|
527
|
-
Fetch the given `url` using the option `{method: 'put'}`.
|
|
528
|
-
|
|
529
|
-
@param url - `Request` object, `URL` object, or URL string.
|
|
530
|
-
@returns A promise with `Body` methods added.
|
|
531
|
-
*/
|
|
532
|
-
put: <T>(url: Input, options?: Options) => ResponsePromise<T>;
|
|
533
|
-
/**
|
|
534
|
-
Fetch the given `url` using the option `{method: 'delete'}`.
|
|
535
|
-
|
|
536
|
-
@param url - `Request` object, `URL` object, or URL string.
|
|
537
|
-
@returns A promise with `Body` methods added.
|
|
538
|
-
*/
|
|
539
|
-
delete: <T>(url: Input, options?: Options) => ResponsePromise<T>;
|
|
540
|
-
/**
|
|
541
|
-
Fetch the given `url` using the option `{method: 'patch'}`.
|
|
542
|
-
|
|
543
|
-
@param url - `Request` object, `URL` object, or URL string.
|
|
544
|
-
@returns A promise with `Body` methods added.
|
|
545
|
-
*/
|
|
546
|
-
patch: <T>(url: Input, options?: Options) => ResponsePromise<T>;
|
|
547
|
-
/**
|
|
548
|
-
Fetch the given `url` using the option `{method: 'head'}`.
|
|
549
|
-
|
|
550
|
-
@param url - `Request` object, `URL` object, or URL string.
|
|
551
|
-
@returns A promise with `Body` methods added.
|
|
552
|
-
*/
|
|
553
|
-
head: (url: Input, options?: Options) => ResponsePromise;
|
|
554
|
-
/**
|
|
555
|
-
Create a new Ky instance with complete new defaults.
|
|
556
|
-
|
|
557
|
-
@returns A new Ky instance.
|
|
558
|
-
*/
|
|
559
|
-
create: (defaultOptions?: Options) => KyInstance;
|
|
560
|
-
/**
|
|
561
|
-
Create a new Ky instance with some defaults overridden with your own.
|
|
562
|
-
|
|
563
|
-
In contrast to `ky.create()`, `ky.extend()` inherits defaults from its parent.
|
|
564
|
-
|
|
565
|
-
You can also refer to parent defaults by providing a function to `.extend()`.
|
|
566
|
-
|
|
567
|
-
@example
|
|
568
|
-
```
|
|
569
|
-
import ky from 'ky';
|
|
570
|
-
|
|
571
|
-
const api = ky.create({prefixUrl: 'https://example.com/api'});
|
|
572
|
-
|
|
573
|
-
const usersApi = api.extend((options) => ({prefixUrl: `${options.prefixUrl}/users`}));
|
|
574
|
-
|
|
575
|
-
const response = await usersApi.get('123');
|
|
576
|
-
//=> 'https://example.com/api/users/123'
|
|
577
|
-
|
|
578
|
-
const response = await api.get('version');
|
|
579
|
-
//=> 'https://example.com/api/version'
|
|
580
|
-
```
|
|
581
|
-
|
|
582
|
-
@returns A new Ky instance.
|
|
583
|
-
*/
|
|
584
|
-
extend: (defaultOptions: Options | ((parentOptions: Options) => Options)) => KyInstance;
|
|
585
|
-
/**
|
|
586
|
-
A `Symbol` that can be returned by a `beforeRetry` hook to stop the retry. This will also short circuit the remaining `beforeRetry` hooks.
|
|
587
|
-
|
|
588
|
-
Note: Returning this symbol makes Ky abort and return with an `undefined` response. Be sure to check for a response before accessing any properties on it or use [optional chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining). It is also incompatible with body methods, such as `.json()` or `.text()`, because there is no response to parse. In general, we recommend throwing an error instead of returning this symbol, as that will cause Ky to abort and then throw, which avoids these limitations.
|
|
589
|
-
|
|
590
|
-
A valid use-case for `ky.stop` is to prevent retries when making requests for side effects, where the returned data is not important. For example, logging client activity to the server.
|
|
591
|
-
|
|
592
|
-
@example
|
|
593
|
-
```
|
|
594
|
-
import ky from 'ky';
|
|
595
|
-
|
|
596
|
-
const options = {
|
|
597
|
-
hooks: {
|
|
598
|
-
beforeRetry: [
|
|
599
|
-
async ({request, options, error, retryCount}) => {
|
|
600
|
-
const shouldStopRetry = await ky('https://example.com/api');
|
|
601
|
-
if (shouldStopRetry) {
|
|
602
|
-
return ky.stop;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
]
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
|
|
609
|
-
// Note that response will be `undefined` in case `ky.stop` is returned.
|
|
610
|
-
const response = await ky.post('https://example.com', options);
|
|
611
|
-
|
|
612
|
-
// Using `.text()` or other body methods is not supported.
|
|
613
|
-
const text = await ky('https://example.com', options).text();
|
|
614
|
-
```
|
|
615
|
-
*/
|
|
616
|
-
readonly stop: typeof stop;
|
|
617
|
-
};
|
|
1
|
+
import * as node_stream_web0 from "node:stream/web";
|
|
2
|
+
import { HTTPError, KyInstance } from "ky";
|
|
3
|
+
import { ReadableStream as ReadableStream$1 } from "stream/web";
|
|
618
4
|
|
|
5
|
+
//#region src/lib/GoogleSpreadsheetRow.d.ts
|
|
619
6
|
declare class GoogleSpreadsheetRow<T extends Record<string, any> = Record<string, any>> {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
7
|
+
/** parent GoogleSpreadsheetWorksheet instance */
|
|
8
|
+
readonly _worksheet: GoogleSpreadsheetWorksheet;
|
|
9
|
+
/** the A1 row (1-indexed) */
|
|
10
|
+
private _rowNumber;
|
|
11
|
+
/** raw underlying data for row */
|
|
12
|
+
private _rawData;
|
|
13
|
+
constructor(/** parent GoogleSpreadsheetWorksheet instance */
|
|
14
|
+
|
|
15
|
+
_worksheet: GoogleSpreadsheetWorksheet, /** the A1 row (1-indexed) */
|
|
16
|
+
|
|
17
|
+
_rowNumber: number, /** raw underlying data for row */
|
|
18
|
+
|
|
19
|
+
_rawData: any[]);
|
|
20
|
+
private _deleted;
|
|
21
|
+
get deleted(): boolean;
|
|
22
|
+
/** row number (matches A1 notation, ie first row is 1) */
|
|
23
|
+
get rowNumber(): number;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
* Used internally to update row numbers after deleting rows.
|
|
27
|
+
* Should not be called directly.
|
|
28
|
+
*/
|
|
29
|
+
_updateRowNumber(newRowNumber: number): void;
|
|
30
|
+
get a1Range(): string;
|
|
31
|
+
/** get row's value of specific cell (by header key) */
|
|
32
|
+
get(key: keyof T): any;
|
|
33
|
+
/** set row's value of specific cell (by header key) */
|
|
34
|
+
set<K extends keyof T>(key: K, val: T[K]): void;
|
|
35
|
+
/** set multiple values in the row at once from an object */
|
|
36
|
+
assign(obj: Partial<T>): void;
|
|
37
|
+
/** return raw object of row data */
|
|
38
|
+
toObject(): Partial<T>;
|
|
39
|
+
/** save row values */
|
|
40
|
+
save(options?: {
|
|
41
|
+
raw?: boolean;
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
/** delete this row */
|
|
44
|
+
delete(): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* @internal
|
|
47
|
+
* Used internally to clear row data after calling sheet.clearRows
|
|
48
|
+
* Should not be called directly.
|
|
49
|
+
*/
|
|
50
|
+
_clearRowData(): void;
|
|
664
51
|
}
|
|
665
|
-
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/lib/types/util-types.d.ts
|
|
666
54
|
type MakeOptional<Type, Key extends keyof Type> = Omit<Type, Key> & Partial<Pick<Type, Key>>;
|
|
667
|
-
type RecursivePartial<T> = {
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
55
|
+
type RecursivePartial<T> = { [P in keyof T]?: RecursivePartial<T[P]> };
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/lib/types/sheets-types.d.ts
|
|
671
58
|
type Integer = number;
|
|
672
59
|
type SpreadsheetId = string;
|
|
673
60
|
type WorksheetId = number;
|
|
@@ -691,53 +78,13 @@ type LocaleCode = string;
|
|
|
691
78
|
* */
|
|
692
79
|
type Timezone = string;
|
|
693
80
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#SheetType */
|
|
694
|
-
type WorksheetType =
|
|
695
|
-
/** The sheet is a grid. */
|
|
696
|
-
'GRID' |
|
|
697
|
-
/** The sheet has no grid and instead has an object like a chart or image. */
|
|
698
|
-
'OBJECT' |
|
|
699
|
-
/** The sheet connects with an external DataSource and shows the preview of data. */
|
|
700
|
-
'DATA_SOURCE';
|
|
81
|
+
type WorksheetType = /** The sheet is a grid. */'GRID' | /** The sheet has no grid and instead has an object like a chart or image. */'OBJECT' | /** The sheet connects with an external DataSource and shows the preview of data. */'DATA_SOURCE';
|
|
701
82
|
type WorksheetDimension = 'ROWS' | 'COLUMNS';
|
|
702
83
|
type HyperlinkDisplayType = 'LINKED' | 'PLAIN_TEXT';
|
|
703
84
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#numberformattype */
|
|
704
|
-
type NumberFormatType =
|
|
705
|
-
/** Text formatting, e.g 1000.12 */
|
|
706
|
-
'TEXT' |
|
|
707
|
-
/** Number formatting, e.g, 1,000.12 */
|
|
708
|
-
'NUMBER' |
|
|
709
|
-
/** Percent formatting, e.g 10.12% */
|
|
710
|
-
'PERCENT' |
|
|
711
|
-
/** Currency formatting, e.g $1,000.12 */
|
|
712
|
-
'CURRENCY' |
|
|
713
|
-
/** Date formatting, e.g 9/26/2008 */
|
|
714
|
-
'DATE' |
|
|
715
|
-
/** Time formatting, e.g 3:59:00 PM */
|
|
716
|
-
'TIME' |
|
|
717
|
-
/** Date+Time formatting, e.g 9/26/08 15:59:00 */
|
|
718
|
-
'DATE_TIME' |
|
|
719
|
-
/** Scientific number formatting, e.g 1.01E+03 */
|
|
720
|
-
'SCIENTIFIC';
|
|
85
|
+
type NumberFormatType = /** Text formatting, e.g 1000.12 */'TEXT' | /** Number formatting, e.g, 1,000.12 */'NUMBER' | /** Percent formatting, e.g 10.12% */'PERCENT' | /** Currency formatting, e.g $1,000.12 */'CURRENCY' | /** Date formatting, e.g 9/26/2008 */'DATE' | /** Time formatting, e.g 3:59:00 PM */'TIME' | /** Date+Time formatting, e.g 9/26/08 15:59:00 */'DATE_TIME' | /** Scientific number formatting, e.g 1.01E+03 */'SCIENTIFIC';
|
|
721
86
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#errortype */
|
|
722
|
-
type CellValueErrorType =
|
|
723
|
-
/** Corresponds to the #ERROR! error */
|
|
724
|
-
'ERROR' |
|
|
725
|
-
/** Corresponds to the #NULL! error. */
|
|
726
|
-
'NULL_VALUE' |
|
|
727
|
-
/** Corresponds to the #DIV/0 error. */
|
|
728
|
-
'DIVIDE_BY_ZERO' |
|
|
729
|
-
/** Corresponds to the #VALUE! error. */
|
|
730
|
-
'VALUE' |
|
|
731
|
-
/** Corresponds to the #REF! error. */
|
|
732
|
-
'REF' |
|
|
733
|
-
/** Corresponds to the #NAME? error. */
|
|
734
|
-
'NAME' |
|
|
735
|
-
/** Corresponds to the #NUM! error. */
|
|
736
|
-
'NUM' |
|
|
737
|
-
/** Corresponds to the #N/A error. */
|
|
738
|
-
'N_A' |
|
|
739
|
-
/** Corresponds to the Loading... state. */
|
|
740
|
-
'LOADING';
|
|
87
|
+
type CellValueErrorType = /** Corresponds to the #ERROR! error */'ERROR' | /** Corresponds to the #NULL! error. */'NULL_VALUE' | /** Corresponds to the #DIV/0 error. */'DIVIDE_BY_ZERO' | /** Corresponds to the #VALUE! error. */'VALUE' | /** Corresponds to the #REF! error. */'REF' | /** Corresponds to the #NAME? error. */'NAME' | /** Corresponds to the #NUM! error. */'NUM' | /** Corresponds to the #N/A error. */'N_A' | /** Corresponds to the Loading... state. */'LOADING';
|
|
741
88
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#horizontalalign */
|
|
742
89
|
type HorizontalAlign = 'LEFT' | 'CENTER' | 'RIGHT';
|
|
743
90
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#verticalalign */
|
|
@@ -751,323 +98,269 @@ type ThemeColorType = 'TEXT' | 'BACKGROUND' | 'ACCENT1' | 'ACCENT2' | 'ACCENT3'
|
|
|
751
98
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#recalculationinterval */
|
|
752
99
|
type RecalculationInterval = 'ON_CHANGE' | 'MINUTE' | 'HOUR';
|
|
753
100
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#developermetadatavisibility */
|
|
754
|
-
type DeveloperMetadataVisibility =
|
|
755
|
-
/** Document-visible metadata is accessible from any developer project with access to the document. */
|
|
756
|
-
'DOCUMENT'
|
|
757
|
-
/** Project-visible metadata is only visible to and accessible by the developer project that created the metadata. */
|
|
758
|
-
| 'PROJECT';
|
|
101
|
+
type DeveloperMetadataVisibility = /** Document-visible metadata is accessible from any developer project with access to the document. */'DOCUMENT' /** Project-visible metadata is only visible to and accessible by the developer project that created the metadata. */ | 'PROJECT';
|
|
759
102
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#developermetadatalocationtype */
|
|
760
103
|
type DeveloperMetadataLocationType = 'ROW' | 'COLUMN' | 'SHEET' | 'SPREADSHEET';
|
|
761
104
|
type TextFormat = {
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
105
|
+
foregroundColor?: Color;
|
|
106
|
+
foregroundColorStyle?: ColorStyle;
|
|
107
|
+
fontFamily?: string;
|
|
108
|
+
fontSize?: number;
|
|
109
|
+
bold?: boolean;
|
|
110
|
+
italic?: boolean;
|
|
111
|
+
strikethrough?: boolean;
|
|
112
|
+
underline?: boolean;
|
|
770
113
|
};
|
|
771
114
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#Style */
|
|
772
115
|
type CellBorderLineStyle = 'NONE' | 'DOTTED' | 'DASHED' | 'SOLID' | 'SOLID_MEDIUM' | 'SOLID_THICK' | 'DOUBLE';
|
|
773
116
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#Border */
|
|
774
117
|
type CellBorder = {
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
118
|
+
style: CellBorderLineStyle;
|
|
119
|
+
width: number;
|
|
120
|
+
color: Color;
|
|
121
|
+
colorStyle: ColorStyle;
|
|
779
122
|
};
|
|
780
123
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#Borders */
|
|
781
124
|
type CellBorders = {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
125
|
+
top: CellBorder;
|
|
126
|
+
bottom: CellBorder;
|
|
127
|
+
left: CellBorder;
|
|
128
|
+
right: CellBorder;
|
|
786
129
|
};
|
|
787
130
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#Padding */
|
|
788
131
|
type CellPadding = {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
132
|
+
top: number;
|
|
133
|
+
bottom: number;
|
|
134
|
+
left: number;
|
|
135
|
+
right: number;
|
|
793
136
|
};
|
|
794
137
|
type TextRotation = {
|
|
795
|
-
|
|
796
|
-
|
|
138
|
+
angle: number;
|
|
139
|
+
vertical: boolean;
|
|
797
140
|
};
|
|
798
141
|
type DimensionRangeIndexes = {
|
|
799
|
-
|
|
800
|
-
|
|
142
|
+
startIndex: RowOrColumnIndex;
|
|
143
|
+
endIndex: RowOrColumnIndex;
|
|
801
144
|
};
|
|
802
145
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#DeveloperMetadata.DeveloperMetadataLocation */
|
|
803
146
|
interface DeveloperMetadataLocation {
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
147
|
+
sheetId: number;
|
|
148
|
+
spreadsheet: boolean;
|
|
149
|
+
dimensionRange: DimensionRange;
|
|
150
|
+
locationType: DeveloperMetadataLocationType;
|
|
808
151
|
}
|
|
809
152
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#DeveloperMetadata.DeveloperMetadataLocation */
|
|
810
153
|
interface DeveloperMetadata {
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
154
|
+
metadataId: number;
|
|
155
|
+
metadataKey: string;
|
|
156
|
+
metadataValue: string;
|
|
157
|
+
location: DeveloperMetadataLocation;
|
|
158
|
+
visibility: DeveloperMetadataVisibility;
|
|
816
159
|
}
|
|
817
160
|
interface WorksheetDimensionProperties {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
161
|
+
pixelSize: number;
|
|
162
|
+
hiddenByUser: boolean;
|
|
163
|
+
hiddenByFilter: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#DeveloperMetadata
|
|
166
|
+
*/
|
|
167
|
+
developerMetadata: DeveloperMetadata[];
|
|
825
168
|
}
|
|
826
169
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#DataSourceColumnReference */
|
|
827
170
|
type DataSourceColumnReference = {
|
|
828
|
-
|
|
171
|
+
name: string;
|
|
829
172
|
};
|
|
830
173
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#DataSourceColumn */
|
|
831
174
|
type DataSourceColumn = {
|
|
832
|
-
|
|
833
|
-
|
|
175
|
+
reference: DataSourceColumnReference;
|
|
176
|
+
formula: string;
|
|
834
177
|
};
|
|
835
178
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#DataExecutionState */
|
|
836
|
-
type DataExecutionState =
|
|
837
|
-
/** The data execution has not started. */
|
|
838
|
-
'NOT_STARTED' |
|
|
839
|
-
/** The data execution has started and is running. */
|
|
840
|
-
'RUNNING' |
|
|
841
|
-
/** The data execution has completed successfully. */
|
|
842
|
-
'SUCCEEDED' |
|
|
843
|
-
/** The data execution has completed with errors. */
|
|
844
|
-
'FAILED';
|
|
179
|
+
type DataExecutionState = /** The data execution has not started. */'NOT_STARTED' | /** The data execution has started and is running. */'RUNNING' | /** The data execution has completed successfully. */'SUCCEEDED' | /** The data execution has completed with errors. */'FAILED';
|
|
845
180
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#DataExecutionState */
|
|
846
|
-
type DataExecutionErrorCode =
|
|
847
|
-
/** Default value, do not use. */
|
|
848
|
-
'DATA_EXECUTION_ERROR_CODE_UNSPECIFIED' |
|
|
849
|
-
/** The data execution timed out. */
|
|
850
|
-
'TIMED_OUT' |
|
|
851
|
-
/** The data execution returns more rows than the limit. */
|
|
852
|
-
'TOO_MANY_ROWS' |
|
|
853
|
-
/** The data execution returns more columns than the limit. */
|
|
854
|
-
'TOO_MANY_COLUMNS' |
|
|
855
|
-
/** The data execution returns more cells than the limit. */
|
|
856
|
-
'TOO_MANY_CELLS' |
|
|
857
|
-
/** Error is received from the backend data execution engine (e.g. BigQuery). Check errorMessage for details. */
|
|
858
|
-
'ENGINE' |
|
|
859
|
-
/** One or some of the provided data source parameters are invalid. */
|
|
860
|
-
'PARAMETER_INVALID' |
|
|
861
|
-
/** The data execution returns an unsupported data type. */
|
|
862
|
-
'UNSUPPORTED_DATA_TYPE' |
|
|
863
|
-
/** The data execution returns duplicate column names or aliases. */
|
|
864
|
-
'DUPLICATE_COLUMN_NAMES' |
|
|
865
|
-
/** The data execution is interrupted. Please refresh later. */
|
|
866
|
-
'INTERRUPTED' |
|
|
867
|
-
/** The data execution is currently in progress, can not be refreshed until it completes. */
|
|
868
|
-
'CONCURRENT_QUERY' |
|
|
869
|
-
/** Other errors. */
|
|
870
|
-
'OTHER' |
|
|
871
|
-
/** The data execution returns values that exceed the maximum characters allowed in a single cell. */
|
|
872
|
-
'TOO_MANY_CHARS_PER_CELL' |
|
|
873
|
-
/** The database referenced by the data source is not found. */
|
|
874
|
-
'DATA_NOT_FOUND' |
|
|
875
|
-
/** The user does not have access to the database referenced by the data source. */
|
|
876
|
-
'PERMISSION_DENIED' |
|
|
877
|
-
/** The data execution returns columns with missing aliases. */
|
|
878
|
-
'MISSING_COLUMN_ALIAS' |
|
|
879
|
-
/** The data source object does not exist. */
|
|
880
|
-
'OBJECT_NOT_FOUND' |
|
|
881
|
-
/** The data source object is currently in error state. To force refresh, set force in RefreshDataSourceRequest . */
|
|
882
|
-
'OBJECT_IN_ERROR_STATE' |
|
|
883
|
-
/** The data source object specification is invalid. */
|
|
884
|
-
'OBJECT_SPEC_INVALID';
|
|
181
|
+
type DataExecutionErrorCode = /** Default value, do not use. */'DATA_EXECUTION_ERROR_CODE_UNSPECIFIED' | /** The data execution timed out. */'TIMED_OUT' | /** The data execution returns more rows than the limit. */'TOO_MANY_ROWS' | /** The data execution returns more columns than the limit. */'TOO_MANY_COLUMNS' | /** The data execution returns more cells than the limit. */'TOO_MANY_CELLS' | /** Error is received from the backend data execution engine (e.g. BigQuery). Check errorMessage for details. */'ENGINE' | /** One or some of the provided data source parameters are invalid. */'PARAMETER_INVALID' | /** The data execution returns an unsupported data type. */'UNSUPPORTED_DATA_TYPE' | /** The data execution returns duplicate column names or aliases. */'DUPLICATE_COLUMN_NAMES' | /** The data execution is interrupted. Please refresh later. */'INTERRUPTED' | /** The data execution is currently in progress, can not be refreshed until it completes. */'CONCURRENT_QUERY' | /** Other errors. */'OTHER' | /** The data execution returns values that exceed the maximum characters allowed in a single cell. */'TOO_MANY_CHARS_PER_CELL' | /** The database referenced by the data source is not found. */'DATA_NOT_FOUND' | /** The user does not have access to the database referenced by the data source. */'PERMISSION_DENIED' | /** The data execution returns columns with missing aliases. */'MISSING_COLUMN_ALIAS' | /** The data source object does not exist. */'OBJECT_NOT_FOUND' | /** The data source object is currently in error state. To force refresh, set force in RefreshDataSourceRequest . */'OBJECT_IN_ERROR_STATE' | /** The data source object specification is invalid. */'OBJECT_SPEC_INVALID';
|
|
885
182
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#DataExecutionStatus */
|
|
886
183
|
type DataExecutionStatus = {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
184
|
+
'state': DataExecutionState;
|
|
185
|
+
'errorCode': DataExecutionErrorCode;
|
|
186
|
+
'errorMessage': string;
|
|
187
|
+
'lastRefreshTime': string;
|
|
891
188
|
};
|
|
892
189
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#DataSourceSheetProperties */
|
|
893
190
|
type DataSourceSheetProperties = {
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
191
|
+
'dataSourceId': DataSourceId;
|
|
192
|
+
'columns': DataSourceColumn[];
|
|
193
|
+
'dataExecutionStatus': DataExecutionStatus;
|
|
897
194
|
};
|
|
898
195
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#SpreadsheetProperties */
|
|
899
196
|
type SpreadsheetProperties = {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
timeZone: Timezone;
|
|
908
|
-
defaultFormat: any;
|
|
909
|
-
iterativeCalculationSettings: any;
|
|
910
|
-
spreadsheetTheme: any;
|
|
197
|
+
/** title of the spreadsheet */title: string; /** locale of the spreadsheet (note - not all locales are supported) */
|
|
198
|
+
locale: LocaleCode; /** amount of time to wait before volatile functions are recalculated */
|
|
199
|
+
autoRecalc: RecalculationInterval; /** timezone of the sheet */
|
|
200
|
+
timeZone: Timezone;
|
|
201
|
+
defaultFormat: any;
|
|
202
|
+
iterativeCalculationSettings: any;
|
|
203
|
+
spreadsheetTheme: any;
|
|
911
204
|
};
|
|
912
205
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#SheetProperties */
|
|
913
206
|
type WorksheetProperties = {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
207
|
+
'sheetId': WorksheetId;
|
|
208
|
+
'title': string;
|
|
209
|
+
'index': WorksheetIndex;
|
|
210
|
+
'sheetType': WorksheetType;
|
|
211
|
+
'gridProperties': WorksheetGridProperties;
|
|
212
|
+
'hidden': boolean;
|
|
213
|
+
'tabColor': Color;
|
|
214
|
+
'tabColorStyle': ColorStyle;
|
|
215
|
+
'rightToLeft': boolean;
|
|
216
|
+
'dataSourceSheetProperties': DataSourceSheetProperties;
|
|
924
217
|
};
|
|
925
218
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#CellFormat */
|
|
926
219
|
type CellFormat = {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
hyperlinkDisplayType: HyperlinkDisplayType;
|
|
940
|
-
textRotation: TextRotation;
|
|
220
|
+
/** format describing how number values should be represented to the user */numberFormat: NumberFormat; /** @deprecated use backgroundColorStyle */
|
|
221
|
+
backgroundColor: Color;
|
|
222
|
+
backgroundColorStyle: ColorStyle;
|
|
223
|
+
borders: CellBorders;
|
|
224
|
+
padding: CellPadding;
|
|
225
|
+
horizontalAlignment: HorizontalAlign;
|
|
226
|
+
verticalAlignment: VerticalAlign;
|
|
227
|
+
wrapStrategy: WrapStrategy;
|
|
228
|
+
textDirection: TextDirection;
|
|
229
|
+
textFormat: TextFormat;
|
|
230
|
+
hyperlinkDisplayType: HyperlinkDisplayType;
|
|
231
|
+
textRotation: TextRotation;
|
|
941
232
|
};
|
|
942
233
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#numberformat */
|
|
943
234
|
type NumberFormat = {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
235
|
+
type: NumberFormatType;
|
|
236
|
+
/**
|
|
237
|
+
* pattern string used for formatting
|
|
238
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#numberformat
|
|
239
|
+
* */
|
|
240
|
+
pattern: string;
|
|
950
241
|
};
|
|
951
242
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#GridProperties */
|
|
952
243
|
type WorksheetGridProperties = {
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
244
|
+
rowCount: number;
|
|
245
|
+
columnCount: number;
|
|
246
|
+
frozenRowCount?: number;
|
|
247
|
+
frozenColumnCount?: number;
|
|
248
|
+
hideGridlines?: boolean;
|
|
249
|
+
rowGroupControlAfter?: boolean;
|
|
250
|
+
columnGroupControlAfter?: boolean;
|
|
960
251
|
};
|
|
961
252
|
/**
|
|
962
253
|
*
|
|
963
254
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/DimensionRange
|
|
964
255
|
*/
|
|
965
256
|
type DimensionRange = {
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
257
|
+
sheetId: WorksheetId;
|
|
258
|
+
dimension: WorksheetDimension;
|
|
259
|
+
startIndex?: Integer;
|
|
260
|
+
endIndex?: Integer;
|
|
970
261
|
};
|
|
971
262
|
/**
|
|
972
263
|
* object describing a range in a sheet
|
|
973
264
|
* see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#GridRange
|
|
974
265
|
* */
|
|
975
266
|
type GridRange = {
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
endRowIndex?: Integer;
|
|
982
|
-
/** The start column (inclusive) of the range, or not set if unbounded. */
|
|
983
|
-
startColumnIndex?: Integer;
|
|
984
|
-
/** The end column (exclusive) of the range, or not set if unbounded. */
|
|
985
|
-
endColumnIndex?: Integer;
|
|
267
|
+
/** The sheet this range is on */sheetId: WorksheetId; /** The start row (inclusive) of the range, or not set if unbounded. */
|
|
268
|
+
startRowIndex?: Integer; /** The end row (exclusive) of the range, or not set if unbounded. */
|
|
269
|
+
endRowIndex?: Integer; /** The start column (inclusive) of the range, or not set if unbounded. */
|
|
270
|
+
startColumnIndex?: Integer; /** The end column (exclusive) of the range, or not set if unbounded. */
|
|
271
|
+
endColumnIndex?: Integer;
|
|
986
272
|
};
|
|
987
273
|
type GridRangeWithoutWorksheetId = Omit<GridRange, 'sheetId'>;
|
|
988
274
|
type GridRangeWithOptionalWorksheetId = MakeOptional<GridRange, 'sheetId'>;
|
|
989
275
|
type DataFilter = A1Range | GridRange;
|
|
990
276
|
type DataFilterWithoutWorksheetId = A1Range | GridRangeWithoutWorksheetId;
|
|
277
|
+
/**
|
|
278
|
+
* object describing the editors of a protected range
|
|
279
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#Editors
|
|
280
|
+
* */
|
|
281
|
+
type Editors = {
|
|
282
|
+
/** The email addresses of users with edit access to the protected range. */users?: string[]; /** The email addresses of groups with edit access to the protected range. */
|
|
283
|
+
groups?: string[]; /** True if anyone in the document's domain has edit access to the protected range. */
|
|
284
|
+
domainUsersCanEdit?: boolean;
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* object describing a protected range in a sheet
|
|
288
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#ProtectedRange
|
|
289
|
+
* */
|
|
290
|
+
type ProtectedRange = {
|
|
291
|
+
/** The ID of the protected range - read-only, auto-assigned */protectedRangeId?: Integer; /** The range that is being protected - mutually exclusive with namedRangeId */
|
|
292
|
+
range?: GridRange; /** The named range this protected range is backed by - mutually exclusive with range */
|
|
293
|
+
namedRangeId?: NamedRangeId; /** The description of this protected range */
|
|
294
|
+
description?: string; /** True if this protected range will show a warning when editing. When true, editors is ignored. */
|
|
295
|
+
warningOnly?: boolean; /** True if the user who requested this protected range can edit the protected area - read-only */
|
|
296
|
+
requestingUserCanEdit?: boolean; /** The list of unprotected ranges within a protected sheet. Only supported on protected sheets. */
|
|
297
|
+
unprotectedRanges?: GridRange[]; /** The users and groups with edit access to the protected range. Not supported with warningOnly. */
|
|
298
|
+
editors?: Editors;
|
|
299
|
+
};
|
|
991
300
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#colorstyle */
|
|
992
301
|
type ColorStyle = {
|
|
993
|
-
|
|
302
|
+
rgbColor: Color;
|
|
994
303
|
} | {
|
|
995
|
-
|
|
304
|
+
themeColor: ThemeColorType;
|
|
996
305
|
};
|
|
997
306
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#Color */
|
|
998
307
|
type Color = {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
alpha?: number;
|
|
308
|
+
red: number;
|
|
309
|
+
green: number;
|
|
310
|
+
blue: number; /** docs say alpha is not generally supported? */
|
|
311
|
+
alpha?: number;
|
|
1004
312
|
};
|
|
1005
313
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption */
|
|
1006
|
-
type ValueRenderOption =
|
|
1007
|
-
/** Values will be calculated & formatted in the reply according to the cell's formatting. Formatting is based on the spreadsheet's locale, not the requesting user's locale. For example, if A1 is 1.23 and A2 is =A1 and formatted as currency, then A2 would return "$1.23". */
|
|
1008
|
-
'FORMATTED_VALUE' |
|
|
1009
|
-
/** Values will be calculated, but not formatted in the reply. For example, if A1 is 1.23 and A2 is =A1 and formatted as currency, then A2 would return the number 1.23. */
|
|
1010
|
-
'UNFORMATTED_VALUE' |
|
|
1011
|
-
/** Values will not be calculated. The reply will include the formulas. For example, if A1 is 1.23 and A2 is =A1 and formatted as currency, then A2 would return "=A1". */
|
|
1012
|
-
'FORMULA';
|
|
314
|
+
type ValueRenderOption = /** Values will be calculated & formatted in the reply according to the cell's formatting. Formatting is based on the spreadsheet's locale, not the requesting user's locale. For example, if A1 is 1.23 and A2 is =A1 and formatted as currency, then A2 would return "$1.23". */'FORMATTED_VALUE' | /** Values will be calculated, but not formatted in the reply. For example, if A1 is 1.23 and A2 is =A1 and formatted as currency, then A2 would return the number 1.23. */'UNFORMATTED_VALUE' | /** Values will not be calculated. The reply will include the formulas. For example, if A1 is 1.23 and A2 is =A1 and formatted as currency, then A2 would return "=A1". */'FORMULA';
|
|
1013
315
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get#query-parameters */
|
|
1014
316
|
type GetValuesRequestOptions = {
|
|
1015
|
-
|
|
1016
|
-
|
|
317
|
+
majorDimension?: WorksheetDimension;
|
|
318
|
+
valueRenderOption?: ValueRenderOption;
|
|
1017
319
|
};
|
|
1018
320
|
/**
|
|
1019
321
|
* Info about an error in a cell
|
|
1020
322
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#errortype
|
|
1021
323
|
*/
|
|
1022
324
|
type ErrorValue = {
|
|
1023
|
-
|
|
1024
|
-
|
|
325
|
+
type: CellValueErrorType;
|
|
326
|
+
message: string;
|
|
1025
327
|
};
|
|
1026
328
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#ExtendedValue */
|
|
1027
329
|
type ExtendedValue = {
|
|
1028
|
-
|
|
330
|
+
numberValue: number;
|
|
1029
331
|
} | {
|
|
1030
|
-
|
|
332
|
+
stringValue: string;
|
|
1031
333
|
} | {
|
|
1032
|
-
|
|
334
|
+
boolValue: boolean;
|
|
1033
335
|
} | {
|
|
1034
|
-
|
|
336
|
+
formulaValue: string;
|
|
1035
337
|
} | {
|
|
1036
|
-
|
|
338
|
+
errorValue: ErrorValue;
|
|
1037
339
|
};
|
|
1038
340
|
type CellValueType = 'boolValue' | 'stringValue' | 'numberValue' | 'errorValue';
|
|
1039
341
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells */
|
|
1040
342
|
type CellData = {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
userEnteredFormat: CellFormat;
|
|
1049
|
-
/** The effective format being used by the cell. This includes the results of applying any conditional formatting and, if the cell contains a formula, the computed number format. If the effective format is the default format, effective format will not be written. This field is read-only. */
|
|
1050
|
-
effectiveFormat: CellFormat;
|
|
1051
|
-
/** hyperlink in the cell if any */
|
|
1052
|
-
hyperlink?: string;
|
|
1053
|
-
/** note on the cell */
|
|
1054
|
-
note?: string;
|
|
343
|
+
/** The value the user entered in the cell. e.g., 1234, 'Hello', or =NOW() Note: Dates, Times and DateTimes are represented as doubles in serial number format. */userEnteredValue: ExtendedValue; /** The effective value of the cell. For cells with formulas, this is the calculated value. For cells with literals, this is the same as the userEnteredValue. This field is read-only. */
|
|
344
|
+
effectiveValue: ExtendedValue; /** The formatted value of the cell. This is the value as it's shown to the user. This field is read-only. */
|
|
345
|
+
formattedValue: string; /** The format the user entered for the cell. */
|
|
346
|
+
userEnteredFormat: CellFormat; /** The effective format being used by the cell. This includes the results of applying any conditional formatting and, if the cell contains a formula, the computed number format. If the effective format is the default format, effective format will not be written. This field is read-only. */
|
|
347
|
+
effectiveFormat: CellFormat; /** hyperlink in the cell if any */
|
|
348
|
+
hyperlink?: string; /** note on the cell */
|
|
349
|
+
note?: string;
|
|
1055
350
|
};
|
|
1056
351
|
/** shape of the cell data sent back when fetching the sheet */
|
|
1057
352
|
type CellDataRange = {
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
353
|
+
startRow?: RowIndex;
|
|
354
|
+
startColumn?: ColumnIndex;
|
|
355
|
+
rowMetadata: any[];
|
|
356
|
+
columnMetadata: any[];
|
|
357
|
+
rowData: {
|
|
358
|
+
values: any[];
|
|
359
|
+
}[];
|
|
1065
360
|
};
|
|
1066
361
|
type AddRowOptions = {
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
/** set to true to insert new rows in the sheet while adding this data */
|
|
1070
|
-
insert?: boolean;
|
|
362
|
+
/** set to true to use raw mode rather than user entered */raw?: boolean; /** set to true to insert new rows in the sheet while adding this data */
|
|
363
|
+
insert?: boolean;
|
|
1071
364
|
};
|
|
1072
365
|
/**
|
|
1073
366
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#ConditionType
|
|
@@ -1081,23 +374,22 @@ type RelativeDate = 'PAST_YEAR' | 'PAST_MONTH' | 'PAST_WEEK' | 'YESTERDAY' | 'TO
|
|
|
1081
374
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#ConditionValue
|
|
1082
375
|
*/
|
|
1083
376
|
type ConditionValue = {
|
|
1084
|
-
|
|
1085
|
-
|
|
377
|
+
relativeDate: RelativeDate;
|
|
378
|
+
userEnteredValue?: undefined;
|
|
1086
379
|
} | {
|
|
1087
|
-
|
|
1088
|
-
|
|
380
|
+
relativeDate?: undefined;
|
|
381
|
+
userEnteredValue: string;
|
|
1089
382
|
};
|
|
1090
383
|
/**
|
|
1091
384
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#BooleanCondition
|
|
1092
385
|
*/
|
|
1093
386
|
type BooleanCondition = {
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
values: ConditionValue[];
|
|
387
|
+
/** The type of condition. */type: ConditionType;
|
|
388
|
+
/**
|
|
389
|
+
* The values of the condition.
|
|
390
|
+
* The number of supported values depends on the condition type. Some support zero values, others one or two values, and ConditionType.ONE_OF_LIST supports an arbitrary number of values.
|
|
391
|
+
*/
|
|
392
|
+
values: ConditionValue[];
|
|
1101
393
|
};
|
|
1102
394
|
/**
|
|
1103
395
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#DataValidationRule
|
|
@@ -1106,16 +398,13 @@ type BooleanCondition = {
|
|
|
1106
398
|
* - https://stackoverflow.com/a/43442775/3068233
|
|
1107
399
|
*/
|
|
1108
400
|
type DataValidationRule = {
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
/** True if invalid data should be rejected. */
|
|
1114
|
-
strict: boolean;
|
|
1115
|
-
/** True if the UI should be customized based on the kind of condition. If true, "List" conditions will show a dropdown. */
|
|
1116
|
-
showCustomUi: boolean;
|
|
401
|
+
/** The condition that data in the cell must match. */condition: BooleanCondition; /** A message to show the user when adding data to the cell. */
|
|
402
|
+
inputMessage?: string; /** True if invalid data should be rejected. */
|
|
403
|
+
strict: boolean; /** True if the UI should be customized based on the kind of condition. If true, "List" conditions will show a dropdown. */
|
|
404
|
+
showCustomUi: boolean;
|
|
1117
405
|
};
|
|
1118
|
-
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/lib/GoogleSpreadsheetCellErrorValue.d.ts
|
|
1119
408
|
/**
|
|
1120
409
|
* Cell error
|
|
1121
410
|
*
|
|
@@ -1125,364 +414,397 @@ type DataValidationRule = {
|
|
|
1125
414
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#ErrorType
|
|
1126
415
|
*/
|
|
1127
416
|
declare class GoogleSpreadsheetCellErrorValue {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
417
|
+
/**
|
|
418
|
+
* type of the error
|
|
419
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#ErrorType
|
|
420
|
+
* */
|
|
421
|
+
readonly type: CellValueErrorType;
|
|
422
|
+
/** A message with more information about the error (in the spreadsheet's locale) */
|
|
423
|
+
readonly message: string;
|
|
424
|
+
constructor(rawError: ErrorValue);
|
|
1136
425
|
}
|
|
1137
|
-
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/lib/GoogleSpreadsheetCell.d.ts
|
|
1138
428
|
declare class GoogleSpreadsheetCell {
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
429
|
+
readonly _sheet: GoogleSpreadsheetWorksheet;
|
|
430
|
+
private _rowIndex;
|
|
431
|
+
private _columnIndex;
|
|
432
|
+
private _rawData?;
|
|
433
|
+
private _draftData;
|
|
434
|
+
private _error?;
|
|
435
|
+
constructor(_sheet: GoogleSpreadsheetWorksheet, _rowIndex: RowIndex, _columnIndex: ColumnIndex, rawCellData: CellData);
|
|
436
|
+
/**
|
|
437
|
+
* update cell using raw CellData coming back from sheets API
|
|
438
|
+
* @internal
|
|
439
|
+
*/
|
|
440
|
+
_updateRawData(newData: CellData): void;
|
|
441
|
+
get rowIndex(): number;
|
|
442
|
+
get columnIndex(): number;
|
|
443
|
+
get a1Column(): string;
|
|
444
|
+
get a1Row(): number;
|
|
445
|
+
get a1Address(): string;
|
|
446
|
+
get value(): number | boolean | string | null | GoogleSpreadsheetCellErrorValue;
|
|
447
|
+
set value(newValue: number | boolean | Date | string | null | undefined | GoogleSpreadsheetCellErrorValue);
|
|
448
|
+
get valueType(): CellValueType | null;
|
|
449
|
+
/** The formatted value of the cell - this is the value as it's shown to the user */
|
|
450
|
+
get formattedValue(): string | null;
|
|
451
|
+
get formula(): string | null;
|
|
452
|
+
set formula(newValue: string | null);
|
|
453
|
+
/**
|
|
454
|
+
* @deprecated use `cell.errorValue` instead
|
|
455
|
+
*/
|
|
456
|
+
get formulaError(): GoogleSpreadsheetCellErrorValue | undefined;
|
|
457
|
+
/**
|
|
458
|
+
* error contained in the cell, which can happen with a bad formula (maybe some other weird cases?)
|
|
459
|
+
*/
|
|
460
|
+
get errorValue(): GoogleSpreadsheetCellErrorValue | undefined;
|
|
461
|
+
get numberValue(): number | undefined;
|
|
462
|
+
set numberValue(val: number | undefined);
|
|
463
|
+
get boolValue(): boolean | undefined;
|
|
464
|
+
set boolValue(val: boolean | undefined);
|
|
465
|
+
get stringValue(): string | undefined;
|
|
466
|
+
set stringValue(val: string | undefined);
|
|
467
|
+
/**
|
|
468
|
+
* Hyperlink contained within the cell.
|
|
469
|
+
*
|
|
470
|
+
* To modify, do not set directly. Instead set cell.formula, for example `cell.formula = \'=HYPERLINK("http://google.com", "Google")\'`
|
|
471
|
+
*/
|
|
472
|
+
get hyperlink(): string | undefined;
|
|
473
|
+
/** a note attached to the cell */
|
|
474
|
+
get note(): string;
|
|
475
|
+
set note(newVal: string | null | undefined | false);
|
|
476
|
+
get userEnteredFormat(): Readonly<CellFormat | undefined>;
|
|
477
|
+
get effectiveFormat(): Readonly<CellFormat | undefined>;
|
|
478
|
+
private _getFormatParam;
|
|
479
|
+
private _setFormatParam;
|
|
480
|
+
get numberFormat(): CellFormat["numberFormat"];
|
|
481
|
+
get backgroundColor(): CellFormat["backgroundColor"];
|
|
482
|
+
get backgroundColorStyle(): CellFormat["backgroundColorStyle"];
|
|
483
|
+
get borders(): CellFormat["borders"];
|
|
484
|
+
get padding(): CellFormat["padding"];
|
|
485
|
+
get horizontalAlignment(): CellFormat["horizontalAlignment"];
|
|
486
|
+
get verticalAlignment(): CellFormat["verticalAlignment"];
|
|
487
|
+
get wrapStrategy(): CellFormat["wrapStrategy"];
|
|
488
|
+
get textDirection(): CellFormat["textDirection"];
|
|
489
|
+
get textFormat(): CellFormat["textFormat"];
|
|
490
|
+
get hyperlinkDisplayType(): CellFormat["hyperlinkDisplayType"];
|
|
491
|
+
get textRotation(): CellFormat["textRotation"];
|
|
492
|
+
set numberFormat(newVal: CellFormat['numberFormat']);
|
|
493
|
+
set backgroundColor(newVal: CellFormat['backgroundColor']);
|
|
494
|
+
set backgroundColorStyle(newVal: CellFormat['backgroundColorStyle']);
|
|
495
|
+
set borders(newVal: CellFormat['borders']);
|
|
496
|
+
set padding(newVal: CellFormat['padding']);
|
|
497
|
+
set horizontalAlignment(newVal: CellFormat['horizontalAlignment']);
|
|
498
|
+
set verticalAlignment(newVal: CellFormat['verticalAlignment']);
|
|
499
|
+
set wrapStrategy(newVal: CellFormat['wrapStrategy']);
|
|
500
|
+
set textDirection(newVal: CellFormat['textDirection']);
|
|
501
|
+
set textFormat(newVal: CellFormat['textFormat']);
|
|
502
|
+
set hyperlinkDisplayType(newVal: CellFormat['hyperlinkDisplayType']);
|
|
503
|
+
set textRotation(newVal: CellFormat['textRotation']);
|
|
504
|
+
clearAllFormatting(): void;
|
|
505
|
+
get _isDirty(): boolean;
|
|
506
|
+
discardUnsavedChanges(): void;
|
|
507
|
+
/**
|
|
508
|
+
* saves updates for single cell
|
|
509
|
+
* usually it's better to make changes and call sheet.saveUpdatedCells
|
|
510
|
+
* */
|
|
511
|
+
save(): Promise<void>;
|
|
512
|
+
/**
|
|
513
|
+
* used by worksheet when saving cells
|
|
514
|
+
* returns an individual batchUpdate request to update the cell
|
|
515
|
+
* @internal
|
|
516
|
+
*/
|
|
517
|
+
_getUpdateRequest(): {
|
|
518
|
+
updateCells: {
|
|
519
|
+
rows: {
|
|
520
|
+
values: any[];
|
|
521
|
+
}[];
|
|
522
|
+
fields: string;
|
|
523
|
+
start: {
|
|
524
|
+
sheetId: number;
|
|
525
|
+
rowIndex: number;
|
|
526
|
+
columnIndex: number;
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
} | null;
|
|
1240
530
|
}
|
|
1241
|
-
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region src/lib/GoogleSpreadsheetWorksheet.d.ts
|
|
1242
533
|
type RowCellData = string | number | boolean | Date;
|
|
1243
534
|
type RawRowData = RowCellData[] | Record<string, RowCellData>;
|
|
1244
535
|
declare class GoogleSpreadsheetWorksheet {
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
536
|
+
/** parent GoogleSpreadsheet instance */
|
|
537
|
+
readonly _spreadsheet: GoogleSpreadsheet;
|
|
538
|
+
private _headerRowIndex;
|
|
539
|
+
private _rawProperties;
|
|
540
|
+
private _cells;
|
|
541
|
+
private _rowMetadata;
|
|
542
|
+
private _columnMetadata;
|
|
543
|
+
private _protectedRanges;
|
|
544
|
+
private _headerValues;
|
|
545
|
+
get headerValues(): string[];
|
|
546
|
+
constructor(/** parent GoogleSpreadsheet instance */
|
|
547
|
+
|
|
548
|
+
_spreadsheet: GoogleSpreadsheet, rawProperties: WorksheetProperties, rawCellData?: CellDataRange[], protectedRanges?: ProtectedRange[]);
|
|
549
|
+
updateRawData(properties: WorksheetProperties, rawCellData: CellDataRange[], protectedRanges?: ProtectedRange[]): void;
|
|
550
|
+
_makeSingleUpdateRequest(requestType: string, requestParams: any): Promise<any>;
|
|
551
|
+
private _ensureInfoLoaded;
|
|
552
|
+
/** clear local cache of sheet data/properties */
|
|
553
|
+
resetLocalCache(/** set to true to clear data only, leaving sheet metadata/propeties intact */
|
|
554
|
+
|
|
555
|
+
dataOnly?: boolean): void;
|
|
556
|
+
private _fillCellData;
|
|
557
|
+
private _addSheetIdToRange;
|
|
558
|
+
private _getProp;
|
|
559
|
+
private _setProp;
|
|
560
|
+
get sheetId(): WorksheetProperties["sheetId"];
|
|
561
|
+
get title(): WorksheetProperties["title"];
|
|
562
|
+
get index(): WorksheetProperties["index"];
|
|
563
|
+
get sheetType(): WorksheetProperties["sheetType"];
|
|
564
|
+
get gridProperties(): WorksheetProperties["gridProperties"];
|
|
565
|
+
get hidden(): WorksheetProperties["hidden"];
|
|
566
|
+
get tabColor(): WorksheetProperties["tabColor"];
|
|
567
|
+
get rightToLeft(): WorksheetProperties["rightToLeft"];
|
|
568
|
+
get protectedRanges(): ProtectedRange[] | null;
|
|
569
|
+
private get _headerRange();
|
|
570
|
+
set sheetId(newVal: WorksheetProperties['sheetId']);
|
|
571
|
+
set title(newVal: WorksheetProperties['title']);
|
|
572
|
+
set index(newVal: WorksheetProperties['index']);
|
|
573
|
+
set sheetType(newVal: WorksheetProperties['sheetType']);
|
|
574
|
+
set gridProperties(newVal: WorksheetProperties['gridProperties']);
|
|
575
|
+
set hidden(newVal: WorksheetProperties['hidden']);
|
|
576
|
+
set tabColor(newVal: WorksheetProperties['tabColor']);
|
|
577
|
+
set rightToLeft(newVal: WorksheetProperties['rightToLeft']);
|
|
578
|
+
get rowCount(): number;
|
|
579
|
+
get columnCount(): number;
|
|
580
|
+
get a1SheetName(): string;
|
|
581
|
+
get encodedA1SheetName(): string;
|
|
582
|
+
get lastColumnLetter(): string;
|
|
583
|
+
get cellStats(): {
|
|
584
|
+
nonEmpty: number;
|
|
585
|
+
loaded: number;
|
|
586
|
+
total: number;
|
|
587
|
+
};
|
|
588
|
+
getCellByA1(a1Address: A1Address): GoogleSpreadsheetCell;
|
|
589
|
+
getCell(rowIndex: RowIndex, columnIndex: ColumnIndex): GoogleSpreadsheetCell;
|
|
590
|
+
loadCells(sheetFilters?: DataFilterWithoutWorksheetId | DataFilterWithoutWorksheetId[]): Promise<void>;
|
|
591
|
+
saveUpdatedCells(): Promise<void>;
|
|
592
|
+
saveCells(cellsToUpdate: GoogleSpreadsheetCell[]): Promise<void>;
|
|
593
|
+
_ensureHeaderRowLoaded(): Promise<void>;
|
|
594
|
+
loadHeaderRow(headerRowIndex?: number): Promise<void>;
|
|
595
|
+
private _processHeaderRow;
|
|
596
|
+
setHeaderRow(headerValues: string[], headerRowIndex?: number): Promise<void>;
|
|
597
|
+
addRows(rows: RawRowData[], options?: AddRowOptions): Promise<GoogleSpreadsheetRow<Record<string, any>>[]>;
|
|
598
|
+
/** add a single row - see addRows for more info */
|
|
599
|
+
addRow(rowValues: RawRowData, options?: AddRowOptions): Promise<GoogleSpreadsheetRow<Record<string, any>>>;
|
|
600
|
+
private _rowCache;
|
|
601
|
+
getRows<T extends Record<string, any>>(options?: {
|
|
602
|
+
/** skip first N rows */offset?: number; /** limit number of rows fetched */
|
|
603
|
+
limit?: number;
|
|
604
|
+
}): Promise<GoogleSpreadsheetRow<T>[]>;
|
|
605
|
+
/**
|
|
606
|
+
* @internal
|
|
607
|
+
* Used internally to update row numbers after deleting rows.
|
|
608
|
+
* Should not be called directly.
|
|
609
|
+
* */
|
|
610
|
+
_shiftRowCache(deletedRowNumber: number): void;
|
|
611
|
+
clearRows(options?: {
|
|
612
|
+
start?: number;
|
|
613
|
+
end?: number;
|
|
614
|
+
}): Promise<void>;
|
|
615
|
+
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UpdateSheetPropertiesRequest */
|
|
616
|
+
updateProperties(properties: Partial<Omit<WorksheetProperties, 'sheetId'>>): Promise<any>;
|
|
617
|
+
/**
|
|
618
|
+
* passes through the call to updateProperties to update only the gridProperties object
|
|
619
|
+
*/
|
|
620
|
+
updateGridProperties(gridProperties: WorksheetGridProperties): Promise<any>;
|
|
621
|
+
/** resize, internally just calls updateGridProperties */
|
|
622
|
+
resize(gridProperties: Pick<WorksheetGridProperties, 'rowCount' | 'columnCount'>): Promise<any>;
|
|
623
|
+
/**
|
|
624
|
+
*
|
|
625
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#updatedimensionpropertiesrequest
|
|
626
|
+
*/
|
|
627
|
+
updateDimensionProperties(columnsOrRows: WorksheetDimension, properties: WorksheetDimensionProperties, bounds: Partial<DimensionRangeIndexes>): Promise<any>;
|
|
628
|
+
getCellsInRange(a1Range: A1Range, options?: GetValuesRequestOptions): Promise<any>;
|
|
629
|
+
batchGetCellsInRange(a1Ranges: A1Range[], options?: GetValuesRequestOptions): Promise<any>;
|
|
630
|
+
updateNamedRange(): Promise<void>;
|
|
631
|
+
addNamedRange(): Promise<void>;
|
|
632
|
+
deleteNamedRange(): Promise<void>;
|
|
633
|
+
repeatCell(): Promise<void>;
|
|
634
|
+
autoFill(): Promise<void>;
|
|
635
|
+
cutPaste(): Promise<void>;
|
|
636
|
+
copyPaste(): Promise<void>;
|
|
637
|
+
/**
|
|
638
|
+
* Merges all cells in the range
|
|
639
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#MergeCellsRequest
|
|
640
|
+
*/
|
|
641
|
+
mergeCells(range: GridRangeWithOptionalWorksheetId, mergeType?: string): Promise<void>;
|
|
642
|
+
/**
|
|
643
|
+
* Unmerges cells in the given range
|
|
644
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UnmergeCellsRequest
|
|
645
|
+
*/
|
|
646
|
+
unmergeCells(range: GridRangeWithOptionalWorksheetId): Promise<void>;
|
|
647
|
+
updateBorders(): Promise<void>;
|
|
648
|
+
addFilterView(): Promise<void>;
|
|
649
|
+
appendCells(): Promise<void>;
|
|
650
|
+
clearBasicFilter(): Promise<void>;
|
|
651
|
+
deleteDimension(): Promise<void>;
|
|
652
|
+
deleteEmbeddedObject(): Promise<void>;
|
|
653
|
+
deleteFilterView(): Promise<void>;
|
|
654
|
+
duplicateFilterView(): Promise<void>;
|
|
655
|
+
/**
|
|
656
|
+
* Duplicate worksheet within the document
|
|
657
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DuplicateSheetRequest
|
|
658
|
+
*/
|
|
659
|
+
duplicate(options?: {
|
|
660
|
+
id?: WorksheetId;
|
|
661
|
+
title?: string;
|
|
662
|
+
index?: number;
|
|
663
|
+
}): Promise<GoogleSpreadsheetWorksheet>;
|
|
664
|
+
findReplace(): Promise<void>;
|
|
665
|
+
/**
|
|
666
|
+
* Inserts rows or columns at a particular index
|
|
667
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#InsertDimensionRequest
|
|
668
|
+
*/
|
|
669
|
+
insertDimension(columnsOrRows: WorksheetDimension, rangeIndexes: DimensionRangeIndexes, inheritFromBefore?: boolean): Promise<any>;
|
|
670
|
+
/**
|
|
671
|
+
* insert empty cells in a range, shifting existing cells in the specified direction
|
|
672
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#InsertRangeRequest
|
|
673
|
+
*/
|
|
674
|
+
insertRange(/** the range to insert new cells into */
|
|
675
|
+
|
|
676
|
+
range: GridRangeWithOptionalWorksheetId, /** which direction to shift existing cells - ROWS (shift down) or COLUMNS (shift right) */
|
|
677
|
+
|
|
678
|
+
shiftDimension: WorksheetDimension): Promise<any>;
|
|
679
|
+
moveDimension(): Promise<void>;
|
|
680
|
+
updateEmbeddedObjectPosition(): Promise<void>;
|
|
681
|
+
pasteData(): Promise<void>;
|
|
682
|
+
textToColumns(): Promise<void>;
|
|
683
|
+
updateFilterView(): Promise<void>;
|
|
684
|
+
deleteRange(): Promise<void>;
|
|
685
|
+
appendDimension(): Promise<void>;
|
|
686
|
+
addConditionalFormatRule(): Promise<void>;
|
|
687
|
+
updateConditionalFormatRule(): Promise<void>;
|
|
688
|
+
deleteConditionalFormatRule(): Promise<void>;
|
|
689
|
+
sortRange(): Promise<void>;
|
|
690
|
+
/**
|
|
691
|
+
* Sets (or unsets) a data validation rule to every cell in the range
|
|
692
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#SetDataValidationRequest
|
|
693
|
+
*/
|
|
694
|
+
setDataValidation(range: GridRangeWithOptionalWorksheetId, /** data validation rule object, or set to false to clear an existing rule */
|
|
695
|
+
|
|
696
|
+
rule: DataValidationRule | false): Promise<any>;
|
|
697
|
+
setBasicFilter(): Promise<void>;
|
|
698
|
+
/**
|
|
699
|
+
* add a new protected range to the sheet
|
|
700
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AddProtectedRangeRequest
|
|
701
|
+
*/
|
|
702
|
+
addProtectedRange(protectedRange: ProtectedRange): Promise<any>;
|
|
703
|
+
/**
|
|
704
|
+
* update an existing protected range
|
|
705
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UpdateProtectedRangeRequest
|
|
706
|
+
*/
|
|
707
|
+
updateProtectedRange(protectedRangeId: Integer, protectedRange: Partial<ProtectedRange>): Promise<any>;
|
|
708
|
+
/**
|
|
709
|
+
* delete a protected range by ID
|
|
710
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteProtectedRangeRequest
|
|
711
|
+
*/
|
|
712
|
+
deleteProtectedRange(protectedRangeId: Integer): Promise<any>;
|
|
713
|
+
/**
|
|
714
|
+
* auto-resize rows or columns to fit their contents
|
|
715
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AutoResizeDimensionsRequest
|
|
716
|
+
*/
|
|
717
|
+
autoResizeDimensions(/** which dimension to auto-resize */
|
|
718
|
+
|
|
719
|
+
columnsOrRows: WorksheetDimension, /** start and end indexes (optional, defaults to all) */
|
|
720
|
+
|
|
721
|
+
rangeIndexes?: DimensionRangeIndexes): Promise<any>;
|
|
722
|
+
addChart(): Promise<void>;
|
|
723
|
+
updateChartSpec(): Promise<void>;
|
|
724
|
+
updateBanding(): Promise<void>;
|
|
725
|
+
addBanding(): Promise<void>;
|
|
726
|
+
deleteBanding(): Promise<void>;
|
|
727
|
+
createDeveloperMetadata(): Promise<void>;
|
|
728
|
+
updateDeveloperMetadata(): Promise<void>;
|
|
729
|
+
deleteDeveloperMetadata(): Promise<void>;
|
|
730
|
+
randomizeRange(): Promise<void>;
|
|
731
|
+
addDimensionGroup(): Promise<void>;
|
|
732
|
+
deleteDimensionGroup(): Promise<void>;
|
|
733
|
+
updateDimensionGroup(): Promise<void>;
|
|
734
|
+
trimWhitespace(): Promise<void>;
|
|
735
|
+
deleteDuplicates(): Promise<void>;
|
|
736
|
+
addSlicer(): Promise<void>;
|
|
737
|
+
updateSlicerSpec(): Promise<void>;
|
|
738
|
+
/** delete this worksheet */
|
|
739
|
+
delete(): Promise<void>;
|
|
740
|
+
/**
|
|
741
|
+
* copies this worksheet into another document/spreadsheet
|
|
742
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.sheets/copyTo
|
|
743
|
+
* */
|
|
744
|
+
copyToSpreadsheet(destinationSpreadsheetId: SpreadsheetId): Promise<any>;
|
|
745
|
+
/** clear data in the sheet - either the entire sheet or a specific range */
|
|
746
|
+
clear(/** optional A1 range to clear - defaults to entire sheet */
|
|
747
|
+
|
|
748
|
+
a1Range?: A1Range): Promise<void>;
|
|
749
|
+
/** exports worksheet as CSV file (comma-separated values) */
|
|
750
|
+
downloadAsCSV(): Promise<ArrayBuffer>;
|
|
751
|
+
downloadAsCSV(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
752
|
+
downloadAsCSV(returnStreamInsteadOfBuffer: true): Promise<ReadableStream$1>;
|
|
753
|
+
/** exports worksheet as TSC file (tab-separated values) */
|
|
754
|
+
downloadAsTSV(): Promise<ArrayBuffer>;
|
|
755
|
+
downloadAsTSV(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
756
|
+
downloadAsTSV(returnStreamInsteadOfBuffer: true): Promise<ReadableStream$1>;
|
|
757
|
+
/** exports worksheet as PDF */
|
|
758
|
+
downloadAsPDF(): Promise<ArrayBuffer>;
|
|
759
|
+
downloadAsPDF(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
760
|
+
downloadAsPDF(returnStreamInsteadOfBuffer: true): Promise<ReadableStream$1>;
|
|
1442
761
|
}
|
|
1443
|
-
|
|
762
|
+
//#endregion
|
|
763
|
+
//#region src/lib/types/drive-types.d.ts
|
|
1444
764
|
type PermissionRoles = 'owner' | 'writer' | 'commenter' | 'reader';
|
|
1445
765
|
type PublicPermissionRoles = Exclude<PermissionRoles, 'owner'>;
|
|
1446
766
|
type PublicPermissionListEntry = {
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
767
|
+
id: 'anyoneWithLink';
|
|
768
|
+
type: 'anyone';
|
|
769
|
+
role: PublicPermissionRoles;
|
|
1450
770
|
};
|
|
1451
771
|
type UserOrGroupPermissionListEntry = {
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
772
|
+
id: string;
|
|
773
|
+
displayName: string;
|
|
774
|
+
type: 'user' | 'group';
|
|
775
|
+
photoLink?: string;
|
|
776
|
+
emailAddress: string;
|
|
777
|
+
role: PermissionRoles;
|
|
778
|
+
deleted: boolean;
|
|
1459
779
|
};
|
|
1460
780
|
type DomainPermissionListEntry = {
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
781
|
+
id: string;
|
|
782
|
+
displayName: string;
|
|
783
|
+
type: 'domain';
|
|
784
|
+
domain: string;
|
|
785
|
+
role: PublicPermissionRoles;
|
|
786
|
+
photoLink?: string;
|
|
1467
787
|
};
|
|
1468
788
|
type PermissionsList = (PublicPermissionListEntry | UserOrGroupPermissionListEntry | DomainPermissionListEntry)[];
|
|
1469
|
-
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region src/lib/types/auth-types.d.ts
|
|
1470
791
|
/** single type to handle all valid auth types */
|
|
1471
792
|
type GoogleApiAuth = {
|
|
1472
|
-
|
|
793
|
+
getRequestHeaders: () => Promise<any>;
|
|
1473
794
|
} | {
|
|
1474
|
-
|
|
795
|
+
apiKey: string;
|
|
1475
796
|
} | {
|
|
1476
|
-
|
|
797
|
+
token: string;
|
|
1477
798
|
};
|
|
1478
799
|
declare enum AUTH_MODES {
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
800
|
+
GOOGLE_AUTH_CLIENT = "google_auth",
|
|
801
|
+
RAW_ACCESS_TOKEN = "raw_access_token",
|
|
802
|
+
API_KEY = "api_key"
|
|
1482
803
|
}
|
|
1483
|
-
|
|
804
|
+
//#endregion
|
|
805
|
+
//#region src/lib/GoogleSpreadsheet.d.ts
|
|
1484
806
|
declare const EXPORT_CONFIG: Record<string, {
|
|
1485
|
-
|
|
807
|
+
singleWorksheet?: boolean;
|
|
1486
808
|
}>;
|
|
1487
809
|
type ExportFileTypes = keyof typeof EXPORT_CONFIG;
|
|
1488
810
|
/**
|
|
@@ -1494,159 +816,164 @@ type ExportFileTypes = keyof typeof EXPORT_CONFIG;
|
|
|
1494
816
|
*
|
|
1495
817
|
*/
|
|
1496
818
|
declare class GoogleSpreadsheet {
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
819
|
+
readonly spreadsheetId: string;
|
|
820
|
+
auth: GoogleApiAuth;
|
|
821
|
+
get authMode(): AUTH_MODES;
|
|
822
|
+
private _rawSheets;
|
|
823
|
+
private _rawProperties;
|
|
824
|
+
private _spreadsheetUrl;
|
|
825
|
+
private _deleted;
|
|
826
|
+
/**
|
|
827
|
+
* Sheets API [ky](https://github.com/sindresorhus/ky?tab=readme-ov-file#kycreatedefaultoptions) instance
|
|
828
|
+
* authentication is automatically attached
|
|
829
|
+
* can be used if unsupported sheets calls need to be made
|
|
830
|
+
* @see https://developers.google.com/sheets/api/reference/rest
|
|
831
|
+
* */
|
|
832
|
+
readonly sheetsApi: KyInstance;
|
|
833
|
+
/**
|
|
834
|
+
* Drive API [ky](https://github.com/sindresorhus/ky?tab=readme-ov-file#kycreatedefaultoptions) instance
|
|
835
|
+
* authentication automatically attached
|
|
836
|
+
* can be used if unsupported drive calls need to be made
|
|
837
|
+
* @topic permissions
|
|
838
|
+
* @see https://developers.google.com/drive/api/v3/reference
|
|
839
|
+
* */
|
|
840
|
+
readonly driveApi: KyInstance;
|
|
841
|
+
/**
|
|
842
|
+
* initialize new GoogleSpreadsheet
|
|
843
|
+
* @category Initialization
|
|
844
|
+
* */
|
|
845
|
+
constructor(/** id of google spreadsheet doc */
|
|
846
|
+
|
|
847
|
+
spreadsheetId: SpreadsheetId, /** authentication to use with Google Sheets API */
|
|
848
|
+
|
|
849
|
+
auth: GoogleApiAuth);
|
|
850
|
+
/** @internal */
|
|
851
|
+
_setAuthRequestHook(req: Request): Promise<Request>;
|
|
852
|
+
/** @internal */
|
|
853
|
+
_errorHook(error: HTTPError): Promise<HTTPError<unknown>>;
|
|
854
|
+
/** @internal */
|
|
855
|
+
_makeSingleUpdateRequest(requestType: string, requestParams: any): Promise<any>;
|
|
856
|
+
/** @internal */
|
|
857
|
+
_makeBatchUpdateRequest(requests: any[], responseRanges?: string | string[]): Promise<void>;
|
|
858
|
+
/** @internal */
|
|
859
|
+
_ensureInfoLoaded(): void;
|
|
860
|
+
/** @internal */
|
|
861
|
+
_updateRawProperties(newProperties: SpreadsheetProperties): void;
|
|
862
|
+
/** @internal */
|
|
863
|
+
_updateOrCreateSheet(sheetInfo: {
|
|
864
|
+
properties: WorksheetProperties;
|
|
865
|
+
data: any;
|
|
866
|
+
protectedRanges?: ProtectedRange[];
|
|
867
|
+
}): void;
|
|
868
|
+
_getProp(param: keyof SpreadsheetProperties): any;
|
|
869
|
+
get title(): SpreadsheetProperties['title'];
|
|
870
|
+
get locale(): SpreadsheetProperties['locale'];
|
|
871
|
+
get timeZone(): SpreadsheetProperties['timeZone'];
|
|
872
|
+
get autoRecalc(): SpreadsheetProperties['autoRecalc'];
|
|
873
|
+
get defaultFormat(): SpreadsheetProperties['defaultFormat'];
|
|
874
|
+
get spreadsheetTheme(): SpreadsheetProperties['spreadsheetTheme'];
|
|
875
|
+
get iterativeCalculationSettings(): SpreadsheetProperties['iterativeCalculationSettings'];
|
|
876
|
+
/**
|
|
877
|
+
* update spreadsheet properties
|
|
878
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#SpreadsheetProperties
|
|
879
|
+
* */
|
|
880
|
+
updateProperties(properties: Partial<SpreadsheetProperties>): Promise<void>;
|
|
881
|
+
loadInfo(includeCells?: boolean): Promise<void>;
|
|
882
|
+
resetLocalCache(): void;
|
|
883
|
+
get sheetCount(): number;
|
|
884
|
+
get sheetsById(): Record<WorksheetId, GoogleSpreadsheetWorksheet>;
|
|
885
|
+
get sheetsByIndex(): GoogleSpreadsheetWorksheet[];
|
|
886
|
+
get sheetsByTitle(): Record<string, GoogleSpreadsheetWorksheet>;
|
|
887
|
+
/**
|
|
888
|
+
* Add new worksheet to document
|
|
889
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AddSheetRequest
|
|
890
|
+
* */
|
|
891
|
+
addSheet(properties?: Partial<RecursivePartial<WorksheetProperties> & {
|
|
892
|
+
headerValues: string[];
|
|
893
|
+
headerRowIndex: number;
|
|
894
|
+
}>): Promise<GoogleSpreadsheetWorksheet>;
|
|
895
|
+
/**
|
|
896
|
+
* delete a worksheet
|
|
897
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteSheetRequest
|
|
898
|
+
* */
|
|
899
|
+
deleteSheet(sheetId: WorksheetId): Promise<void>;
|
|
900
|
+
/**
|
|
901
|
+
* create a new named range
|
|
902
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AddNamedRangeRequest
|
|
903
|
+
*/
|
|
904
|
+
addNamedRange(/** name of new named range */
|
|
905
|
+
|
|
906
|
+
name: string, /** GridRange object describing range */
|
|
907
|
+
|
|
908
|
+
range: GridRange, /** id for named range (optional) */
|
|
909
|
+
|
|
910
|
+
namedRangeId?: string): Promise<any>;
|
|
911
|
+
/**
|
|
912
|
+
* delete a named range
|
|
913
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteNamedRangeRequest
|
|
914
|
+
* */
|
|
915
|
+
deleteNamedRange(/** id of named range to delete */
|
|
916
|
+
|
|
917
|
+
namedRangeId: NamedRangeId): Promise<any>;
|
|
918
|
+
/** fetch cell data into local cache */
|
|
919
|
+
loadCells(
|
|
920
|
+
/**
|
|
921
|
+
* single filter or array of filters
|
|
922
|
+
* strings are treated as A1 ranges, objects are treated as GridRange objects
|
|
923
|
+
* pass nothing to fetch all cells
|
|
924
|
+
* */
|
|
925
|
+
|
|
926
|
+
filters?: DataFilter | DataFilter[]): Promise<void>;
|
|
927
|
+
/**
|
|
928
|
+
* export/download helper, not meant to be called directly (use downloadAsX methods on spreadsheet and worksheet instead)
|
|
929
|
+
* @internal
|
|
930
|
+
*/
|
|
931
|
+
_downloadAs(fileType: ExportFileTypes, worksheetId: WorksheetId | undefined, returnStreamInsteadOfBuffer?: boolean): Promise<ArrayBuffer | node_stream_web0.ReadableStream<any> | null>;
|
|
932
|
+
/**
|
|
933
|
+
* exports entire document as html file (zipped)
|
|
934
|
+
* @topic export
|
|
935
|
+
* */
|
|
936
|
+
downloadAsZippedHTML(): Promise<ArrayBuffer>;
|
|
937
|
+
downloadAsZippedHTML(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
938
|
+
downloadAsZippedHTML(returnStreamInsteadOfBuffer: true): Promise<ReadableStream>;
|
|
939
|
+
/**
|
|
940
|
+
* @deprecated
|
|
941
|
+
* use `doc.downloadAsZippedHTML()` instead
|
|
942
|
+
* */
|
|
943
|
+
downloadAsHTML(returnStreamInsteadOfBuffer?: boolean): Promise<ArrayBuffer | node_stream_web0.ReadableStream<any> | null>;
|
|
944
|
+
/**
|
|
945
|
+
* exports entire document as xlsx spreadsheet (Microsoft Office Excel)
|
|
946
|
+
* @topic export
|
|
947
|
+
* */
|
|
948
|
+
downloadAsXLSX(): Promise<ArrayBuffer>;
|
|
949
|
+
downloadAsXLSX(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
950
|
+
downloadAsXLSX(returnStreamInsteadOfBuffer: true): Promise<ReadableStream>;
|
|
951
|
+
/**
|
|
952
|
+
* exports entire document as ods spreadsheet (Open Office)
|
|
953
|
+
* @topic export
|
|
954
|
+
*/
|
|
955
|
+
downloadAsODS(): Promise<ArrayBuffer>;
|
|
956
|
+
downloadAsODS(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
957
|
+
downloadAsODS(returnStreamInsteadOfBuffer: true): Promise<ReadableStream>;
|
|
958
|
+
delete(): Promise<void>;
|
|
959
|
+
/**
|
|
960
|
+
* list all permissions entries for doc
|
|
961
|
+
*/
|
|
962
|
+
listPermissions(): Promise<PermissionsList>;
|
|
963
|
+
setPublicAccessLevel(role: PublicPermissionRoles | false): Promise<void>;
|
|
964
|
+
/** share document to email or domain */
|
|
965
|
+
share(emailAddressOrDomain: string, opts?: {
|
|
966
|
+
/** set role level, defaults to owner */role?: PermissionRoles; /** set to true if email is for a group */
|
|
967
|
+
isGroup?: boolean; /** set to string to include a custom message, set to false to skip sending a notification altogether */
|
|
968
|
+
emailMessage?: string | false;
|
|
969
|
+
}): Promise<unknown>;
|
|
970
|
+
/**
|
|
971
|
+
* delete a permission by its ID
|
|
972
|
+
* @see https://developers.google.com/drive/api/v3/reference/permissions/delete
|
|
973
|
+
*/
|
|
974
|
+
deletePermission(permissionId: string): Promise<void>;
|
|
975
|
+
static createNewSpreadsheetDocument(auth: GoogleApiAuth, properties?: Partial<SpreadsheetProperties>): Promise<GoogleSpreadsheet>;
|
|
1650
976
|
}
|
|
1651
|
-
|
|
977
|
+
//#endregion
|
|
1652
978
|
export { GoogleSpreadsheet, GoogleSpreadsheetCell, GoogleSpreadsheetCellErrorValue, GoogleSpreadsheetRow, GoogleSpreadsheetWorksheet };
|
|
979
|
+
//# sourceMappingURL=index.d.cts.map
|