google-spreadsheet 5.0.2 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +1900 -1637
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1332 -816
- package/dist/index.d.ts +1332 -816
- package/dist/index.js +1872 -1632
- package/dist/index.js.map +1 -1
- package/package.json +21 -25
- package/src/lib/GoogleSpreadsheet.ts +21 -9
- package/src/lib/GoogleSpreadsheetCell.ts +24 -0
- package/src/lib/GoogleSpreadsheetRow.ts +10 -0
- package/src/lib/GoogleSpreadsheetWorksheet.ts +865 -138
- package/src/lib/types/sheets-types.ts +290 -8
package/dist/index.d.cts
CHANGED
|
@@ -1,59 +1,66 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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";
|
|
4
4
|
|
|
5
|
+
//#region src/lib/GoogleSpreadsheetRow.d.ts
|
|
5
6
|
declare class GoogleSpreadsheetRow<T extends Record<string, any> = Record<string, any>> {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** parent GoogleSpreadsheetWorksheet instance */
|
|
14
|
-
_worksheet: GoogleSpreadsheetWorksheet,
|
|
15
|
-
/** the A1 row (1-indexed) */
|
|
16
|
-
_rowNumber: number,
|
|
17
|
-
/** raw underlying data for row */
|
|
18
|
-
_rawData: any[]);
|
|
19
|
-
private _deleted;
|
|
20
|
-
get deleted(): boolean;
|
|
21
|
-
/** row number (matches A1 notation, ie first row is 1) */
|
|
22
|
-
get rowNumber(): number;
|
|
23
|
-
/**
|
|
24
|
-
* @internal
|
|
25
|
-
* Used internally to update row numbers after deleting rows.
|
|
26
|
-
* Should not be called directly.
|
|
27
|
-
*/
|
|
28
|
-
_updateRowNumber(newRowNumber: number): void;
|
|
29
|
-
get a1Range(): string;
|
|
30
|
-
/** get row's value of specific cell (by header key) */
|
|
31
|
-
get(key: keyof T): any;
|
|
32
|
-
/** set row's value of specific cell (by header key) */
|
|
33
|
-
set<K extends keyof T>(key: K, val: T[K]): void;
|
|
34
|
-
/** set multiple values in the row at once from an object */
|
|
35
|
-
assign(obj: Partial<T>): void;
|
|
36
|
-
/** return raw object of row data */
|
|
37
|
-
toObject(): Partial<T>;
|
|
38
|
-
/** save row values */
|
|
39
|
-
save(options?: {
|
|
40
|
-
raw?: boolean;
|
|
41
|
-
}): Promise<void>;
|
|
42
|
-
/** delete this row */
|
|
43
|
-
delete(): Promise<any>;
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
* Used internally to clear row data after calling sheet.clearRows
|
|
47
|
-
* Should not be called directly.
|
|
48
|
-
*/
|
|
49
|
-
_clearRowData(): void;
|
|
50
|
-
}
|
|
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 */
|
|
51
14
|
|
|
52
|
-
|
|
53
|
-
type RecursivePartial<T> = {
|
|
54
|
-
[P in keyof T]?: RecursivePartial<T[P]>;
|
|
55
|
-
};
|
|
15
|
+
_worksheet: GoogleSpreadsheetWorksheet, /** the A1 row (1-indexed) */
|
|
56
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
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
* Used internally to mark row as deleted.
|
|
33
|
+
* Should not be called directly.
|
|
34
|
+
*/
|
|
35
|
+
_markDeleted(): void;
|
|
36
|
+
get a1Range(): string;
|
|
37
|
+
/** get row's value of specific cell (by header key) */
|
|
38
|
+
get(key: keyof T): any;
|
|
39
|
+
/** set row's value of specific cell (by header key) */
|
|
40
|
+
set<K extends keyof T>(key: K, val: T[K]): void;
|
|
41
|
+
/** set multiple values in the row at once from an object */
|
|
42
|
+
assign(obj: Partial<T>): void;
|
|
43
|
+
/** return raw object of row data */
|
|
44
|
+
toObject(): Partial<T>;
|
|
45
|
+
/** save row values */
|
|
46
|
+
save(options?: {
|
|
47
|
+
raw?: boolean;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/** delete this row */
|
|
50
|
+
delete(): Promise<any>;
|
|
51
|
+
/**
|
|
52
|
+
* @internal
|
|
53
|
+
* Used internally to clear row data after calling sheet.clearRows
|
|
54
|
+
* Should not be called directly.
|
|
55
|
+
*/
|
|
56
|
+
_clearRowData(): void;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/lib/types/util-types.d.ts
|
|
60
|
+
type MakeOptional<Type, Key extends keyof Type> = Omit<Type, Key> & Partial<Pick<Type, Key>>;
|
|
61
|
+
type RecursivePartial<T> = { [P in keyof T]?: RecursivePartial<T[P]> };
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/lib/types/sheets-types.d.ts
|
|
57
64
|
type Integer = number;
|
|
58
65
|
type SpreadsheetId = string;
|
|
59
66
|
type WorksheetId = number;
|
|
@@ -77,53 +84,13 @@ type LocaleCode = string;
|
|
|
77
84
|
* */
|
|
78
85
|
type Timezone = string;
|
|
79
86
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#SheetType */
|
|
80
|
-
type WorksheetType =
|
|
81
|
-
/** The sheet is a grid. */
|
|
82
|
-
'GRID' |
|
|
83
|
-
/** The sheet has no grid and instead has an object like a chart or image. */
|
|
84
|
-
'OBJECT' |
|
|
85
|
-
/** The sheet connects with an external DataSource and shows the preview of data. */
|
|
86
|
-
'DATA_SOURCE';
|
|
87
|
+
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';
|
|
87
88
|
type WorksheetDimension = 'ROWS' | 'COLUMNS';
|
|
88
89
|
type HyperlinkDisplayType = 'LINKED' | 'PLAIN_TEXT';
|
|
89
90
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#numberformattype */
|
|
90
|
-
type NumberFormatType =
|
|
91
|
-
/** Text formatting, e.g 1000.12 */
|
|
92
|
-
'TEXT' |
|
|
93
|
-
/** Number formatting, e.g, 1,000.12 */
|
|
94
|
-
'NUMBER' |
|
|
95
|
-
/** Percent formatting, e.g 10.12% */
|
|
96
|
-
'PERCENT' |
|
|
97
|
-
/** Currency formatting, e.g $1,000.12 */
|
|
98
|
-
'CURRENCY' |
|
|
99
|
-
/** Date formatting, e.g 9/26/2008 */
|
|
100
|
-
'DATE' |
|
|
101
|
-
/** Time formatting, e.g 3:59:00 PM */
|
|
102
|
-
'TIME' |
|
|
103
|
-
/** Date+Time formatting, e.g 9/26/08 15:59:00 */
|
|
104
|
-
'DATE_TIME' |
|
|
105
|
-
/** Scientific number formatting, e.g 1.01E+03 */
|
|
106
|
-
'SCIENTIFIC';
|
|
91
|
+
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';
|
|
107
92
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#errortype */
|
|
108
|
-
type CellValueErrorType =
|
|
109
|
-
/** Corresponds to the #ERROR! error */
|
|
110
|
-
'ERROR' |
|
|
111
|
-
/** Corresponds to the #NULL! error. */
|
|
112
|
-
'NULL_VALUE' |
|
|
113
|
-
/** Corresponds to the #DIV/0 error. */
|
|
114
|
-
'DIVIDE_BY_ZERO' |
|
|
115
|
-
/** Corresponds to the #VALUE! error. */
|
|
116
|
-
'VALUE' |
|
|
117
|
-
/** Corresponds to the #REF! error. */
|
|
118
|
-
'REF' |
|
|
119
|
-
/** Corresponds to the #NAME? error. */
|
|
120
|
-
'NAME' |
|
|
121
|
-
/** Corresponds to the #NUM! error. */
|
|
122
|
-
'NUM' |
|
|
123
|
-
/** Corresponds to the #N/A error. */
|
|
124
|
-
'N_A' |
|
|
125
|
-
/** Corresponds to the Loading... state. */
|
|
126
|
-
'LOADING';
|
|
93
|
+
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';
|
|
127
94
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#horizontalalign */
|
|
128
95
|
type HorizontalAlign = 'LEFT' | 'CENTER' | 'RIGHT';
|
|
129
96
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#verticalalign */
|
|
@@ -137,323 +104,318 @@ type ThemeColorType = 'TEXT' | 'BACKGROUND' | 'ACCENT1' | 'ACCENT2' | 'ACCENT3'
|
|
|
137
104
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#recalculationinterval */
|
|
138
105
|
type RecalculationInterval = 'ON_CHANGE' | 'MINUTE' | 'HOUR';
|
|
139
106
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#developermetadatavisibility */
|
|
140
|
-
type DeveloperMetadataVisibility =
|
|
141
|
-
/** Document-visible metadata is accessible from any developer project with access to the document. */
|
|
142
|
-
'DOCUMENT'
|
|
143
|
-
/** Project-visible metadata is only visible to and accessible by the developer project that created the metadata. */
|
|
144
|
-
| 'PROJECT';
|
|
107
|
+
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';
|
|
145
108
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#developermetadatalocationtype */
|
|
146
109
|
type DeveloperMetadataLocationType = 'ROW' | 'COLUMN' | 'SHEET' | 'SPREADSHEET';
|
|
147
110
|
type TextFormat = {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
111
|
+
foregroundColor?: Color;
|
|
112
|
+
foregroundColorStyle?: ColorStyle;
|
|
113
|
+
fontFamily?: string;
|
|
114
|
+
fontSize?: number;
|
|
115
|
+
bold?: boolean;
|
|
116
|
+
italic?: boolean;
|
|
117
|
+
strikethrough?: boolean;
|
|
118
|
+
underline?: boolean;
|
|
156
119
|
};
|
|
157
120
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#Style */
|
|
158
121
|
type CellBorderLineStyle = 'NONE' | 'DOTTED' | 'DASHED' | 'SOLID' | 'SOLID_MEDIUM' | 'SOLID_THICK' | 'DOUBLE';
|
|
159
122
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#Border */
|
|
160
123
|
type CellBorder = {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
124
|
+
style: CellBorderLineStyle;
|
|
125
|
+
width: number;
|
|
126
|
+
color: Color;
|
|
127
|
+
colorStyle: ColorStyle;
|
|
165
128
|
};
|
|
166
129
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#Borders */
|
|
167
130
|
type CellBorders = {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
131
|
+
top: CellBorder;
|
|
132
|
+
bottom: CellBorder;
|
|
133
|
+
left: CellBorder;
|
|
134
|
+
right: CellBorder;
|
|
172
135
|
};
|
|
173
136
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#Padding */
|
|
174
137
|
type CellPadding = {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
138
|
+
top: number;
|
|
139
|
+
bottom: number;
|
|
140
|
+
left: number;
|
|
141
|
+
right: number;
|
|
179
142
|
};
|
|
180
143
|
type TextRotation = {
|
|
181
|
-
|
|
182
|
-
|
|
144
|
+
angle: number;
|
|
145
|
+
vertical: boolean;
|
|
183
146
|
};
|
|
184
147
|
type DimensionRangeIndexes = {
|
|
185
|
-
|
|
186
|
-
|
|
148
|
+
startIndex: RowOrColumnIndex;
|
|
149
|
+
endIndex: RowOrColumnIndex;
|
|
187
150
|
};
|
|
188
151
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#DeveloperMetadata.DeveloperMetadataLocation */
|
|
189
152
|
interface DeveloperMetadataLocation {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
153
|
+
sheetId?: number;
|
|
154
|
+
spreadsheet?: boolean;
|
|
155
|
+
dimensionRange?: DimensionRange;
|
|
156
|
+
locationType?: DeveloperMetadataLocationType;
|
|
194
157
|
}
|
|
195
158
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#DeveloperMetadata.DeveloperMetadataLocation */
|
|
196
159
|
interface DeveloperMetadata {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
160
|
+
metadataId?: number;
|
|
161
|
+
metadataKey: string;
|
|
162
|
+
metadataValue?: string;
|
|
163
|
+
location?: DeveloperMetadataLocation;
|
|
164
|
+
visibility?: DeveloperMetadataVisibility;
|
|
202
165
|
}
|
|
203
166
|
interface WorksheetDimensionProperties {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
167
|
+
pixelSize: number;
|
|
168
|
+
hiddenByUser: boolean;
|
|
169
|
+
hiddenByFilter: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#DeveloperMetadata
|
|
172
|
+
*/
|
|
173
|
+
developerMetadata: DeveloperMetadata[];
|
|
211
174
|
}
|
|
212
175
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#DataSourceColumnReference */
|
|
213
176
|
type DataSourceColumnReference = {
|
|
214
|
-
|
|
177
|
+
name: string;
|
|
215
178
|
};
|
|
216
179
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#DataSourceColumn */
|
|
217
180
|
type DataSourceColumn = {
|
|
218
|
-
|
|
219
|
-
|
|
181
|
+
reference: DataSourceColumnReference;
|
|
182
|
+
formula: string;
|
|
220
183
|
};
|
|
221
184
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#DataExecutionState */
|
|
222
|
-
type DataExecutionState =
|
|
223
|
-
/** The data execution has not started. */
|
|
224
|
-
'NOT_STARTED' |
|
|
225
|
-
/** The data execution has started and is running. */
|
|
226
|
-
'RUNNING' |
|
|
227
|
-
/** The data execution has completed successfully. */
|
|
228
|
-
'SUCCEEDED' |
|
|
229
|
-
/** The data execution has completed with errors. */
|
|
230
|
-
'FAILED';
|
|
185
|
+
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';
|
|
231
186
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#DataExecutionState */
|
|
232
|
-
type DataExecutionErrorCode =
|
|
233
|
-
/** Default value, do not use. */
|
|
234
|
-
'DATA_EXECUTION_ERROR_CODE_UNSPECIFIED' |
|
|
235
|
-
/** The data execution timed out. */
|
|
236
|
-
'TIMED_OUT' |
|
|
237
|
-
/** The data execution returns more rows than the limit. */
|
|
238
|
-
'TOO_MANY_ROWS' |
|
|
239
|
-
/** The data execution returns more columns than the limit. */
|
|
240
|
-
'TOO_MANY_COLUMNS' |
|
|
241
|
-
/** The data execution returns more cells than the limit. */
|
|
242
|
-
'TOO_MANY_CELLS' |
|
|
243
|
-
/** Error is received from the backend data execution engine (e.g. BigQuery). Check errorMessage for details. */
|
|
244
|
-
'ENGINE' |
|
|
245
|
-
/** One or some of the provided data source parameters are invalid. */
|
|
246
|
-
'PARAMETER_INVALID' |
|
|
247
|
-
/** The data execution returns an unsupported data type. */
|
|
248
|
-
'UNSUPPORTED_DATA_TYPE' |
|
|
249
|
-
/** The data execution returns duplicate column names or aliases. */
|
|
250
|
-
'DUPLICATE_COLUMN_NAMES' |
|
|
251
|
-
/** The data execution is interrupted. Please refresh later. */
|
|
252
|
-
'INTERRUPTED' |
|
|
253
|
-
/** The data execution is currently in progress, can not be refreshed until it completes. */
|
|
254
|
-
'CONCURRENT_QUERY' |
|
|
255
|
-
/** Other errors. */
|
|
256
|
-
'OTHER' |
|
|
257
|
-
/** The data execution returns values that exceed the maximum characters allowed in a single cell. */
|
|
258
|
-
'TOO_MANY_CHARS_PER_CELL' |
|
|
259
|
-
/** The database referenced by the data source is not found. */
|
|
260
|
-
'DATA_NOT_FOUND' |
|
|
261
|
-
/** The user does not have access to the database referenced by the data source. */
|
|
262
|
-
'PERMISSION_DENIED' |
|
|
263
|
-
/** The data execution returns columns with missing aliases. */
|
|
264
|
-
'MISSING_COLUMN_ALIAS' |
|
|
265
|
-
/** The data source object does not exist. */
|
|
266
|
-
'OBJECT_NOT_FOUND' |
|
|
267
|
-
/** The data source object is currently in error state. To force refresh, set force in RefreshDataSourceRequest . */
|
|
268
|
-
'OBJECT_IN_ERROR_STATE' |
|
|
269
|
-
/** The data source object specification is invalid. */
|
|
270
|
-
'OBJECT_SPEC_INVALID';
|
|
187
|
+
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';
|
|
271
188
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#DataExecutionStatus */
|
|
272
189
|
type DataExecutionStatus = {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
190
|
+
'state': DataExecutionState;
|
|
191
|
+
'errorCode': DataExecutionErrorCode;
|
|
192
|
+
'errorMessage': string;
|
|
193
|
+
'lastRefreshTime': string;
|
|
277
194
|
};
|
|
278
195
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#DataSourceSheetProperties */
|
|
279
196
|
type DataSourceSheetProperties = {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
197
|
+
'dataSourceId': DataSourceId;
|
|
198
|
+
'columns': DataSourceColumn[];
|
|
199
|
+
'dataExecutionStatus': DataExecutionStatus;
|
|
283
200
|
};
|
|
284
201
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#SpreadsheetProperties */
|
|
285
202
|
type SpreadsheetProperties = {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
timeZone: Timezone;
|
|
294
|
-
defaultFormat: any;
|
|
295
|
-
iterativeCalculationSettings: any;
|
|
296
|
-
spreadsheetTheme: any;
|
|
203
|
+
/** title of the spreadsheet */title: string; /** locale of the spreadsheet (note - not all locales are supported) */
|
|
204
|
+
locale: LocaleCode; /** amount of time to wait before volatile functions are recalculated */
|
|
205
|
+
autoRecalc: RecalculationInterval; /** timezone of the sheet */
|
|
206
|
+
timeZone: Timezone;
|
|
207
|
+
defaultFormat: any;
|
|
208
|
+
iterativeCalculationSettings: any;
|
|
209
|
+
spreadsheetTheme: any;
|
|
297
210
|
};
|
|
298
211
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#SheetProperties */
|
|
299
212
|
type WorksheetProperties = {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
213
|
+
'sheetId': WorksheetId;
|
|
214
|
+
'title': string;
|
|
215
|
+
'index': WorksheetIndex;
|
|
216
|
+
'sheetType': WorksheetType;
|
|
217
|
+
'gridProperties': WorksheetGridProperties;
|
|
218
|
+
'hidden': boolean;
|
|
219
|
+
'tabColor': Color;
|
|
220
|
+
'tabColorStyle': ColorStyle;
|
|
221
|
+
'rightToLeft': boolean;
|
|
222
|
+
'dataSourceSheetProperties': DataSourceSheetProperties;
|
|
310
223
|
};
|
|
311
224
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#CellFormat */
|
|
312
225
|
type CellFormat = {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
hyperlinkDisplayType: HyperlinkDisplayType;
|
|
326
|
-
textRotation: TextRotation;
|
|
226
|
+
/** format describing how number values should be represented to the user */numberFormat: NumberFormat; /** @deprecated use backgroundColorStyle */
|
|
227
|
+
backgroundColor: Color;
|
|
228
|
+
backgroundColorStyle: ColorStyle;
|
|
229
|
+
borders: CellBorders;
|
|
230
|
+
padding: CellPadding;
|
|
231
|
+
horizontalAlignment: HorizontalAlign;
|
|
232
|
+
verticalAlignment: VerticalAlign;
|
|
233
|
+
wrapStrategy: WrapStrategy;
|
|
234
|
+
textDirection: TextDirection;
|
|
235
|
+
textFormat: TextFormat;
|
|
236
|
+
hyperlinkDisplayType: HyperlinkDisplayType;
|
|
237
|
+
textRotation: TextRotation;
|
|
327
238
|
};
|
|
328
239
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#numberformat */
|
|
329
240
|
type NumberFormat = {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
241
|
+
type: NumberFormatType;
|
|
242
|
+
/**
|
|
243
|
+
* pattern string used for formatting
|
|
244
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#numberformat
|
|
245
|
+
* */
|
|
246
|
+
pattern: string;
|
|
336
247
|
};
|
|
337
248
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#GridProperties */
|
|
338
249
|
type WorksheetGridProperties = {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
250
|
+
rowCount: number;
|
|
251
|
+
columnCount: number;
|
|
252
|
+
frozenRowCount?: number;
|
|
253
|
+
frozenColumnCount?: number;
|
|
254
|
+
hideGridlines?: boolean;
|
|
255
|
+
rowGroupControlAfter?: boolean;
|
|
256
|
+
columnGroupControlAfter?: boolean;
|
|
346
257
|
};
|
|
347
258
|
/**
|
|
348
259
|
*
|
|
349
260
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/DimensionRange
|
|
350
261
|
*/
|
|
351
262
|
type DimensionRange = {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
263
|
+
sheetId: WorksheetId;
|
|
264
|
+
dimension: WorksheetDimension;
|
|
265
|
+
startIndex?: Integer;
|
|
266
|
+
endIndex?: Integer;
|
|
356
267
|
};
|
|
357
268
|
/**
|
|
358
269
|
* object describing a range in a sheet
|
|
359
270
|
* see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#GridRange
|
|
360
271
|
* */
|
|
361
272
|
type GridRange = {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
endRowIndex?: Integer;
|
|
368
|
-
/** The start column (inclusive) of the range, or not set if unbounded. */
|
|
369
|
-
startColumnIndex?: Integer;
|
|
370
|
-
/** The end column (exclusive) of the range, or not set if unbounded. */
|
|
371
|
-
endColumnIndex?: Integer;
|
|
273
|
+
/** The sheet this range is on */sheetId: WorksheetId; /** The start row (inclusive) of the range, or not set if unbounded. */
|
|
274
|
+
startRowIndex?: Integer; /** The end row (exclusive) of the range, or not set if unbounded. */
|
|
275
|
+
endRowIndex?: Integer; /** The start column (inclusive) of the range, or not set if unbounded. */
|
|
276
|
+
startColumnIndex?: Integer; /** The end column (exclusive) of the range, or not set if unbounded. */
|
|
277
|
+
endColumnIndex?: Integer;
|
|
372
278
|
};
|
|
373
279
|
type GridRangeWithoutWorksheetId = Omit<GridRange, 'sheetId'>;
|
|
374
280
|
type GridRangeWithOptionalWorksheetId = MakeOptional<GridRange, 'sheetId'>;
|
|
375
281
|
type DataFilter = A1Range | GridRange;
|
|
376
282
|
type DataFilterWithoutWorksheetId = A1Range | GridRangeWithoutWorksheetId;
|
|
283
|
+
/**
|
|
284
|
+
* A coordinate in a sheet. All indexes are zero-based.
|
|
285
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#GridCoordinate
|
|
286
|
+
*/
|
|
287
|
+
type GridCoordinate = {
|
|
288
|
+
/** The sheet this coordinate is on */sheetId: WorksheetId; /** The row index of the coordinate */
|
|
289
|
+
rowIndex: RowIndex; /** The column index of the coordinate */
|
|
290
|
+
columnIndex: ColumnIndex;
|
|
291
|
+
};
|
|
292
|
+
type GridCoordinateWithOptionalWorksheetId = MakeOptional<GridCoordinate, 'sheetId'>;
|
|
293
|
+
/**
|
|
294
|
+
* How a paste operation should be applied.
|
|
295
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#PasteType
|
|
296
|
+
*/
|
|
297
|
+
type PasteType = 'PASTE_NORMAL' | 'PASTE_VALUES' | 'PASTE_FORMAT' | 'PASTE_NO_BORDERS' | 'PASTE_FORMULA' | 'PASTE_DATA_VALIDATION' | 'PASTE_CONDITIONAL_FORMATTING';
|
|
298
|
+
/**
|
|
299
|
+
* How pasted data should be oriented.
|
|
300
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#PasteOrientation
|
|
301
|
+
*/
|
|
302
|
+
type PasteOrientation = 'NORMAL' | 'TRANSPOSE';
|
|
303
|
+
/**
|
|
304
|
+
* The delimiter type for text to columns operations.
|
|
305
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DelimiterType
|
|
306
|
+
*/
|
|
307
|
+
type DelimiterType = 'DELIMITER_TYPE_UNSPECIFIED' | 'COMMA' | 'SEMICOLON' | 'PERIOD' | 'SPACE' | 'CUSTOM' | 'AUTODETECT';
|
|
308
|
+
/**
|
|
309
|
+
* The order data should be sorted.
|
|
310
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#sortorder
|
|
311
|
+
*/
|
|
312
|
+
type SortOrder = 'SORT_ORDER_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
|
|
313
|
+
/**
|
|
314
|
+
* A sort order specification for a single column.
|
|
315
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#sortspec
|
|
316
|
+
*/
|
|
317
|
+
type SortSpec = {
|
|
318
|
+
/** The dimension (column index) to sort by */dimensionIndex: Integer; /** The order data should be sorted */
|
|
319
|
+
sortOrder?: SortOrder; /** Background color to sort by - cells with this color are sorted to the top */
|
|
320
|
+
backgroundColorStyle?: any; /** Foreground color to sort by - cells with this color are sorted to the top */
|
|
321
|
+
foregroundColorStyle?: any;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* Source and destination areas for autofill operations.
|
|
325
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#SourceAndDestination
|
|
326
|
+
*/
|
|
327
|
+
type SourceAndDestination = {
|
|
328
|
+
/** The source range to autofill from (sheetId optional) */source: GridRangeWithOptionalWorksheetId; /** The dimension that data should be filled in */
|
|
329
|
+
dimension: WorksheetDimension; /** The number of rows or columns to fill (positive = after, negative = before) */
|
|
330
|
+
fillLength: Integer;
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* object describing the editors of a protected range
|
|
334
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#Editors
|
|
335
|
+
* */
|
|
336
|
+
type Editors = {
|
|
337
|
+
/** 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. */
|
|
338
|
+
groups?: string[]; /** True if anyone in the document's domain has edit access to the protected range. */
|
|
339
|
+
domainUsersCanEdit?: boolean;
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* object describing a protected range in a sheet
|
|
343
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#ProtectedRange
|
|
344
|
+
* */
|
|
345
|
+
type ProtectedRange = {
|
|
346
|
+
/** The ID of the protected range - read-only, auto-assigned */protectedRangeId?: Integer; /** The range that is being protected - mutually exclusive with namedRangeId */
|
|
347
|
+
range?: GridRange; /** The named range this protected range is backed by - mutually exclusive with range */
|
|
348
|
+
namedRangeId?: NamedRangeId; /** The description of this protected range */
|
|
349
|
+
description?: string; /** True if this protected range will show a warning when editing. When true, editors is ignored. */
|
|
350
|
+
warningOnly?: boolean; /** True if the user who requested this protected range can edit the protected area - read-only */
|
|
351
|
+
requestingUserCanEdit?: boolean; /** The list of unprotected ranges within a protected sheet. Only supported on protected sheets. */
|
|
352
|
+
unprotectedRanges?: GridRange[]; /** The users and groups with edit access to the protected range. Not supported with warningOnly. */
|
|
353
|
+
editors?: Editors;
|
|
354
|
+
};
|
|
377
355
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#colorstyle */
|
|
378
356
|
type ColorStyle = {
|
|
379
|
-
|
|
357
|
+
rgbColor: Color;
|
|
380
358
|
} | {
|
|
381
|
-
|
|
359
|
+
themeColor: ThemeColorType;
|
|
382
360
|
};
|
|
383
361
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#Color */
|
|
384
362
|
type Color = {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
alpha?: number;
|
|
363
|
+
red: number;
|
|
364
|
+
green: number;
|
|
365
|
+
blue: number; /** docs say alpha is not generally supported? */
|
|
366
|
+
alpha?: number;
|
|
390
367
|
};
|
|
391
368
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption */
|
|
392
|
-
type ValueRenderOption =
|
|
393
|
-
/** 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". */
|
|
394
|
-
'FORMATTED_VALUE' |
|
|
395
|
-
/** 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. */
|
|
396
|
-
'UNFORMATTED_VALUE' |
|
|
397
|
-
/** 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". */
|
|
398
|
-
'FORMULA';
|
|
369
|
+
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';
|
|
399
370
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get#query-parameters */
|
|
400
371
|
type GetValuesRequestOptions = {
|
|
401
|
-
|
|
402
|
-
|
|
372
|
+
majorDimension?: WorksheetDimension;
|
|
373
|
+
valueRenderOption?: ValueRenderOption;
|
|
403
374
|
};
|
|
404
375
|
/**
|
|
405
376
|
* Info about an error in a cell
|
|
406
377
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#errortype
|
|
407
378
|
*/
|
|
408
379
|
type ErrorValue = {
|
|
409
|
-
|
|
410
|
-
|
|
380
|
+
type: CellValueErrorType;
|
|
381
|
+
message: string;
|
|
411
382
|
};
|
|
412
383
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#ExtendedValue */
|
|
413
384
|
type ExtendedValue = {
|
|
414
|
-
|
|
385
|
+
numberValue: number;
|
|
415
386
|
} | {
|
|
416
|
-
|
|
387
|
+
stringValue: string;
|
|
417
388
|
} | {
|
|
418
|
-
|
|
389
|
+
boolValue: boolean;
|
|
419
390
|
} | {
|
|
420
|
-
|
|
391
|
+
formulaValue: string;
|
|
421
392
|
} | {
|
|
422
|
-
|
|
393
|
+
errorValue: ErrorValue;
|
|
423
394
|
};
|
|
424
395
|
type CellValueType = 'boolValue' | 'stringValue' | 'numberValue' | 'errorValue';
|
|
425
396
|
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells */
|
|
426
397
|
type CellData = {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
userEnteredFormat: CellFormat;
|
|
435
|
-
/** 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. */
|
|
436
|
-
effectiveFormat: CellFormat;
|
|
437
|
-
/** hyperlink in the cell if any */
|
|
438
|
-
hyperlink?: string;
|
|
439
|
-
/** note on the cell */
|
|
440
|
-
note?: string;
|
|
398
|
+
/** 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. */
|
|
399
|
+
effectiveValue: ExtendedValue; /** The formatted value of the cell. This is the value as it's shown to the user. This field is read-only. */
|
|
400
|
+
formattedValue: string; /** The format the user entered for the cell. */
|
|
401
|
+
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. */
|
|
402
|
+
effectiveFormat: CellFormat; /** hyperlink in the cell if any */
|
|
403
|
+
hyperlink?: string; /** note on the cell */
|
|
404
|
+
note?: string;
|
|
441
405
|
};
|
|
442
406
|
/** shape of the cell data sent back when fetching the sheet */
|
|
443
407
|
type CellDataRange = {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
408
|
+
startRow?: RowIndex;
|
|
409
|
+
startColumn?: ColumnIndex;
|
|
410
|
+
rowMetadata: any[];
|
|
411
|
+
columnMetadata: any[];
|
|
412
|
+
rowData: {
|
|
413
|
+
values: any[];
|
|
414
|
+
}[];
|
|
451
415
|
};
|
|
452
416
|
type AddRowOptions = {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
/** set to true to insert new rows in the sheet while adding this data */
|
|
456
|
-
insert?: boolean;
|
|
417
|
+
/** 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 */
|
|
418
|
+
insert?: boolean;
|
|
457
419
|
};
|
|
458
420
|
/**
|
|
459
421
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#ConditionType
|
|
@@ -467,23 +429,22 @@ type RelativeDate = 'PAST_YEAR' | 'PAST_MONTH' | 'PAST_WEEK' | 'YESTERDAY' | 'TO
|
|
|
467
429
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#ConditionValue
|
|
468
430
|
*/
|
|
469
431
|
type ConditionValue = {
|
|
470
|
-
|
|
471
|
-
|
|
432
|
+
relativeDate: RelativeDate;
|
|
433
|
+
userEnteredValue?: undefined;
|
|
472
434
|
} | {
|
|
473
|
-
|
|
474
|
-
|
|
435
|
+
relativeDate?: undefined;
|
|
436
|
+
userEnteredValue: string;
|
|
475
437
|
};
|
|
476
438
|
/**
|
|
477
439
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#BooleanCondition
|
|
478
440
|
*/
|
|
479
441
|
type BooleanCondition = {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
values: ConditionValue[];
|
|
442
|
+
/** The type of condition. */type: ConditionType;
|
|
443
|
+
/**
|
|
444
|
+
* The values of the condition.
|
|
445
|
+
* 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.
|
|
446
|
+
*/
|
|
447
|
+
values: ConditionValue[];
|
|
487
448
|
};
|
|
488
449
|
/**
|
|
489
450
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#DataValidationRule
|
|
@@ -492,16 +453,124 @@ type BooleanCondition = {
|
|
|
492
453
|
* - https://stackoverflow.com/a/43442775/3068233
|
|
493
454
|
*/
|
|
494
455
|
type DataValidationRule = {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
/** True if invalid data should be rejected. */
|
|
500
|
-
strict: boolean;
|
|
501
|
-
/** True if the UI should be customized based on the kind of condition. If true, "List" conditions will show a dropdown. */
|
|
502
|
-
showCustomUi: boolean;
|
|
456
|
+
/** The condition that data in the cell must match. */condition: BooleanCondition; /** A message to show the user when adding data to the cell. */
|
|
457
|
+
inputMessage?: string; /** True if invalid data should be rejected. */
|
|
458
|
+
strict: boolean; /** True if the UI should be customized based on the kind of condition. If true, "List" conditions will show a dropdown. */
|
|
459
|
+
showCustomUi: boolean;
|
|
503
460
|
};
|
|
504
|
-
|
|
461
|
+
/**
|
|
462
|
+
* Filtering specification for a column
|
|
463
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#FilterSpec
|
|
464
|
+
*/
|
|
465
|
+
type FilterSpec = {
|
|
466
|
+
/** The column index */columnIndex?: Integer; /** The filter criteria */
|
|
467
|
+
filterCriteria?: BooleanCondition; /** The reference to the data source column (for data source sheets) */
|
|
468
|
+
dataSourceColumnReference?: any;
|
|
469
|
+
};
|
|
470
|
+
/**
|
|
471
|
+
* A filter view in a sheet
|
|
472
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#FilterView
|
|
473
|
+
*/
|
|
474
|
+
type FilterView = {
|
|
475
|
+
/** The ID of the filter view */filterViewId?: Integer; /** The name of the filter view */
|
|
476
|
+
title?: string; /** The range this filter view covers */
|
|
477
|
+
range?: GridRange; /** The named range this filter view is backed by (mutually exclusive with range) */
|
|
478
|
+
namedRangeId?: string; /** The table this filter view is backed by (mutually exclusive with range) */
|
|
479
|
+
tableId?: string; /** The sort order per column */
|
|
480
|
+
sortSpecs?: SortSpec[]; /** The criteria for showing/hiding values per column (deprecated, use filterSpecs) */
|
|
481
|
+
criteria?: Record<string, BooleanCondition>; /** The filter specifications per column */
|
|
482
|
+
filterSpecs?: FilterSpec[];
|
|
483
|
+
};
|
|
484
|
+
/**
|
|
485
|
+
* A rule describing a conditional format
|
|
486
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#ConditionalFormatRule
|
|
487
|
+
*/
|
|
488
|
+
type ConditionalFormatRule = {
|
|
489
|
+
/** The ranges that are formatted if the condition is true */ranges?: GridRange[]; /** The formatting is either 'on' or 'off' according to the rule */
|
|
490
|
+
booleanRule?: BooleanRule; /** The formatting will vary based on the gradients in the rule */
|
|
491
|
+
gradientRule?: GradientRule;
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* A rule that may or may not match, depending on the condition
|
|
495
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#BooleanRule
|
|
496
|
+
*/
|
|
497
|
+
type BooleanRule = {
|
|
498
|
+
/** The condition of the rule */condition: BooleanCondition; /** The format to apply (partial format supported) */
|
|
499
|
+
format: Partial<CellFormat>;
|
|
500
|
+
};
|
|
501
|
+
/**
|
|
502
|
+
* A rule that applies a gradient color scale format
|
|
503
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#GradientRule
|
|
504
|
+
*/
|
|
505
|
+
type GradientRule = {
|
|
506
|
+
/** The starting point for the gradient */minpoint: InterpolationPoint; /** The midway point for the gradient (optional) */
|
|
507
|
+
midpoint?: InterpolationPoint; /** The final point for the gradient */
|
|
508
|
+
maxpoint: InterpolationPoint;
|
|
509
|
+
};
|
|
510
|
+
/**
|
|
511
|
+
* A single interpolation point on a gradient
|
|
512
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#InterpolationPoint
|
|
513
|
+
*/
|
|
514
|
+
type InterpolationPoint = {
|
|
515
|
+
/** The color to use at this point */color?: Color; /** The color style to use at this point */
|
|
516
|
+
colorStyle?: ColorStyle; /** How to calculate the value that this interpolation point uses */
|
|
517
|
+
type?: InterpolationPointType; /** The value this interpolation point uses */
|
|
518
|
+
value?: string;
|
|
519
|
+
};
|
|
520
|
+
/**
|
|
521
|
+
* The type of interpolation point
|
|
522
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#interpolationpointtype
|
|
523
|
+
*/
|
|
524
|
+
type InterpolationPointType = 'MIN' | 'MAX' | 'NUMBER' | 'PERCENT' | 'PERCENTILE';
|
|
525
|
+
/**
|
|
526
|
+
* Properties for row or column bands
|
|
527
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#BandingProperties
|
|
528
|
+
*/
|
|
529
|
+
type BandingProperties = {
|
|
530
|
+
/** The color of the first row/column (takes priority over band colors) */headerColorStyle?: ColorStyle; /** The color of the last row/column */
|
|
531
|
+
footerColorStyle?: ColorStyle; /** The first color that is alternating (required) */
|
|
532
|
+
firstBandColorStyle?: ColorStyle; /** The second color that is alternating (required) */
|
|
533
|
+
secondBandColorStyle?: ColorStyle;
|
|
534
|
+
};
|
|
535
|
+
/**
|
|
536
|
+
* A banded (alternating colors) range in a sheet
|
|
537
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#BandedRange
|
|
538
|
+
*/
|
|
539
|
+
type BandedRange = {
|
|
540
|
+
/** The id of the banded range */bandedRangeId?: Integer; /** The range over which these properties are applied */
|
|
541
|
+
range?: GridRange; /** Properties for row banding */
|
|
542
|
+
rowProperties?: BandingProperties; /** Properties for column banding */
|
|
543
|
+
columnProperties?: BandingProperties;
|
|
544
|
+
};
|
|
545
|
+
/**
|
|
546
|
+
* Strategy for matching developer metadata locations
|
|
547
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/DataFilter#DeveloperMetadataLookup.DeveloperMetadataLocationMatchingStrategy
|
|
548
|
+
*/
|
|
549
|
+
type DeveloperMetadataLocationMatchingStrategy = 'DEVELOPER_METADATA_LOCATION_MATCHING_STRATEGY_UNSPECIFIED' | 'EXACT_LOCATION' | 'INTERSECTING_LOCATION';
|
|
550
|
+
/**
|
|
551
|
+
* Filter for matching developer metadata
|
|
552
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/DataFilter#DeveloperMetadataLookup
|
|
553
|
+
*/
|
|
554
|
+
type DeveloperMetadataLookup = {
|
|
555
|
+
/** Determines how location matching is performed */locationType?: DeveloperMetadataLocationType; /** Limits the selected metadata to that which has a matching location */
|
|
556
|
+
metadataLocation?: DeveloperMetadataLocation; /** Determines how location matching is done */
|
|
557
|
+
locationMatchingStrategy?: DeveloperMetadataLocationMatchingStrategy; /** Limits the selected metadata to that which has a matching metadata ID */
|
|
558
|
+
metadataId?: Integer; /** Limits the selected metadata to that which has a matching metadata key */
|
|
559
|
+
metadataKey?: string; /** Limits the selected metadata to that which has a matching metadata value */
|
|
560
|
+
metadataValue?: string; /** Limits the selected metadata to that which has a matching visibility */
|
|
561
|
+
visibility?: DeveloperMetadataVisibility;
|
|
562
|
+
};
|
|
563
|
+
/**
|
|
564
|
+
* Filter that describes what data should be selected or returned
|
|
565
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/DataFilter
|
|
566
|
+
*/
|
|
567
|
+
type DataFilterObject = {
|
|
568
|
+
/** Selects data associated with the developer metadata matching the criteria */developerMetadataLookup?: DeveloperMetadataLookup; /** Selects data that matches the specified A1 range */
|
|
569
|
+
a1Range?: A1Range; /** Selects data that matches the range */
|
|
570
|
+
gridRange?: GridRange;
|
|
571
|
+
};
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region src/lib/GoogleSpreadsheetCellErrorValue.d.ts
|
|
505
574
|
/**
|
|
506
575
|
* Cell error
|
|
507
576
|
*
|
|
@@ -511,364 +580,806 @@ type DataValidationRule = {
|
|
|
511
580
|
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#ErrorType
|
|
512
581
|
*/
|
|
513
582
|
declare class GoogleSpreadsheetCellErrorValue {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
583
|
+
/**
|
|
584
|
+
* type of the error
|
|
585
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#ErrorType
|
|
586
|
+
* */
|
|
587
|
+
readonly type: CellValueErrorType;
|
|
588
|
+
/** A message with more information about the error (in the spreadsheet's locale) */
|
|
589
|
+
readonly message: string;
|
|
590
|
+
constructor(rawError: ErrorValue);
|
|
522
591
|
}
|
|
523
|
-
|
|
592
|
+
//#endregion
|
|
593
|
+
//#region src/lib/GoogleSpreadsheetCell.d.ts
|
|
524
594
|
declare class GoogleSpreadsheetCell {
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
595
|
+
readonly _sheet: GoogleSpreadsheetWorksheet;
|
|
596
|
+
private _rowIndex;
|
|
597
|
+
private _columnIndex;
|
|
598
|
+
private _rawData?;
|
|
599
|
+
private _draftData;
|
|
600
|
+
private _error?;
|
|
601
|
+
private _deleted;
|
|
602
|
+
constructor(_sheet: GoogleSpreadsheetWorksheet, _rowIndex: RowIndex, _columnIndex: ColumnIndex, rawCellData: CellData);
|
|
603
|
+
get deleted(): boolean;
|
|
604
|
+
/**
|
|
605
|
+
* update cell using raw CellData coming back from sheets API
|
|
606
|
+
* @internal
|
|
607
|
+
*/
|
|
608
|
+
_updateRawData(newData: CellData): void;
|
|
609
|
+
get rowIndex(): number;
|
|
610
|
+
get columnIndex(): number;
|
|
611
|
+
get a1Column(): string;
|
|
612
|
+
get a1Row(): number;
|
|
613
|
+
get a1Address(): string;
|
|
614
|
+
/**
|
|
615
|
+
* @internal
|
|
616
|
+
* Used internally to update cell indices after deleting rows/columns.
|
|
617
|
+
* Should not be called directly.
|
|
618
|
+
*/
|
|
619
|
+
_updateIndices(rowIndex: RowIndex, columnIndex: ColumnIndex): void;
|
|
620
|
+
/**
|
|
621
|
+
* @internal
|
|
622
|
+
* Used internally to mark cell as deleted.
|
|
623
|
+
* Should not be called directly.
|
|
624
|
+
*/
|
|
625
|
+
_markDeleted(): void;
|
|
626
|
+
get value(): number | boolean | string | null | GoogleSpreadsheetCellErrorValue;
|
|
627
|
+
set value(newValue: number | boolean | Date | string | null | undefined | GoogleSpreadsheetCellErrorValue);
|
|
628
|
+
get valueType(): CellValueType | null;
|
|
629
|
+
/** The formatted value of the cell - this is the value as it's shown to the user */
|
|
630
|
+
get formattedValue(): string | null;
|
|
631
|
+
get formula(): string | null;
|
|
632
|
+
set formula(newValue: string | null);
|
|
633
|
+
/**
|
|
634
|
+
* @deprecated use `cell.errorValue` instead
|
|
635
|
+
*/
|
|
636
|
+
get formulaError(): GoogleSpreadsheetCellErrorValue | undefined;
|
|
637
|
+
/**
|
|
638
|
+
* error contained in the cell, which can happen with a bad formula (maybe some other weird cases?)
|
|
639
|
+
*/
|
|
640
|
+
get errorValue(): GoogleSpreadsheetCellErrorValue | undefined;
|
|
641
|
+
get numberValue(): number | undefined;
|
|
642
|
+
set numberValue(val: number | undefined);
|
|
643
|
+
get boolValue(): boolean | undefined;
|
|
644
|
+
set boolValue(val: boolean | undefined);
|
|
645
|
+
get stringValue(): string | undefined;
|
|
646
|
+
set stringValue(val: string | undefined);
|
|
647
|
+
/**
|
|
648
|
+
* Hyperlink contained within the cell.
|
|
649
|
+
*
|
|
650
|
+
* To modify, do not set directly. Instead set cell.formula, for example `cell.formula = \'=HYPERLINK("http://google.com", "Google")\'`
|
|
651
|
+
*/
|
|
652
|
+
get hyperlink(): string | undefined;
|
|
653
|
+
/** a note attached to the cell */
|
|
654
|
+
get note(): string;
|
|
655
|
+
set note(newVal: string | null | undefined | false);
|
|
656
|
+
get userEnteredFormat(): Readonly<CellFormat | undefined>;
|
|
657
|
+
get effectiveFormat(): Readonly<CellFormat | undefined>;
|
|
658
|
+
private _getFormatParam;
|
|
659
|
+
private _setFormatParam;
|
|
660
|
+
get numberFormat(): CellFormat["numberFormat"];
|
|
661
|
+
get backgroundColor(): CellFormat["backgroundColor"];
|
|
662
|
+
get backgroundColorStyle(): CellFormat["backgroundColorStyle"];
|
|
663
|
+
get borders(): CellFormat["borders"];
|
|
664
|
+
get padding(): CellFormat["padding"];
|
|
665
|
+
get horizontalAlignment(): CellFormat["horizontalAlignment"];
|
|
666
|
+
get verticalAlignment(): CellFormat["verticalAlignment"];
|
|
667
|
+
get wrapStrategy(): CellFormat["wrapStrategy"];
|
|
668
|
+
get textDirection(): CellFormat["textDirection"];
|
|
669
|
+
get textFormat(): CellFormat["textFormat"];
|
|
670
|
+
get hyperlinkDisplayType(): CellFormat["hyperlinkDisplayType"];
|
|
671
|
+
get textRotation(): CellFormat["textRotation"];
|
|
672
|
+
set numberFormat(newVal: CellFormat['numberFormat']);
|
|
673
|
+
set backgroundColor(newVal: CellFormat['backgroundColor']);
|
|
674
|
+
set backgroundColorStyle(newVal: CellFormat['backgroundColorStyle']);
|
|
675
|
+
set borders(newVal: CellFormat['borders']);
|
|
676
|
+
set padding(newVal: CellFormat['padding']);
|
|
677
|
+
set horizontalAlignment(newVal: CellFormat['horizontalAlignment']);
|
|
678
|
+
set verticalAlignment(newVal: CellFormat['verticalAlignment']);
|
|
679
|
+
set wrapStrategy(newVal: CellFormat['wrapStrategy']);
|
|
680
|
+
set textDirection(newVal: CellFormat['textDirection']);
|
|
681
|
+
set textFormat(newVal: CellFormat['textFormat']);
|
|
682
|
+
set hyperlinkDisplayType(newVal: CellFormat['hyperlinkDisplayType']);
|
|
683
|
+
set textRotation(newVal: CellFormat['textRotation']);
|
|
684
|
+
clearAllFormatting(): void;
|
|
685
|
+
get _isDirty(): boolean;
|
|
686
|
+
discardUnsavedChanges(): void;
|
|
687
|
+
/**
|
|
688
|
+
* saves updates for single cell
|
|
689
|
+
* usually it's better to make changes and call sheet.saveUpdatedCells
|
|
690
|
+
* */
|
|
691
|
+
save(): Promise<void>;
|
|
692
|
+
/**
|
|
693
|
+
* used by worksheet when saving cells
|
|
694
|
+
* returns an individual batchUpdate request to update the cell
|
|
695
|
+
* @internal
|
|
696
|
+
*/
|
|
697
|
+
_getUpdateRequest(): {
|
|
698
|
+
updateCells: {
|
|
699
|
+
rows: {
|
|
700
|
+
values: any[];
|
|
701
|
+
}[];
|
|
702
|
+
fields: string;
|
|
703
|
+
start: {
|
|
704
|
+
sheetId: number;
|
|
705
|
+
rowIndex: number;
|
|
706
|
+
columnIndex: number;
|
|
707
|
+
};
|
|
708
|
+
};
|
|
709
|
+
} | null;
|
|
626
710
|
}
|
|
627
|
-
|
|
711
|
+
//#endregion
|
|
712
|
+
//#region src/lib/GoogleSpreadsheetWorksheet.d.ts
|
|
628
713
|
type RowCellData = string | number | boolean | Date;
|
|
629
714
|
type RawRowData = RowCellData[] | Record<string, RowCellData>;
|
|
630
715
|
declare class GoogleSpreadsheetWorksheet {
|
|
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
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
addConditionalFormatRule(): Promise<void>;
|
|
774
|
-
updateConditionalFormatRule(): Promise<void>;
|
|
775
|
-
deleteConditionalFormatRule(): Promise<void>;
|
|
776
|
-
sortRange(): Promise<void>;
|
|
777
|
-
/**
|
|
778
|
-
* Sets (or unsets) a data validation rule to every cell in the range
|
|
779
|
-
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#SetDataValidationRequest
|
|
780
|
-
*/
|
|
781
|
-
setDataValidation(range: GridRangeWithOptionalWorksheetId,
|
|
782
|
-
/** data validation rule object, or set to false to clear an existing rule */
|
|
783
|
-
rule: DataValidationRule | false): Promise<any>;
|
|
784
|
-
setBasicFilter(): Promise<void>;
|
|
785
|
-
addProtectedRange(): Promise<void>;
|
|
786
|
-
updateProtectedRange(): Promise<void>;
|
|
787
|
-
deleteProtectedRange(): Promise<void>;
|
|
788
|
-
autoResizeDimensions(): Promise<void>;
|
|
789
|
-
addChart(): Promise<void>;
|
|
790
|
-
updateChartSpec(): Promise<void>;
|
|
791
|
-
updateBanding(): Promise<void>;
|
|
792
|
-
addBanding(): Promise<void>;
|
|
793
|
-
deleteBanding(): Promise<void>;
|
|
794
|
-
createDeveloperMetadata(): Promise<void>;
|
|
795
|
-
updateDeveloperMetadata(): Promise<void>;
|
|
796
|
-
deleteDeveloperMetadata(): Promise<void>;
|
|
797
|
-
randomizeRange(): Promise<void>;
|
|
798
|
-
addDimensionGroup(): Promise<void>;
|
|
799
|
-
deleteDimensionGroup(): Promise<void>;
|
|
800
|
-
updateDimensionGroup(): Promise<void>;
|
|
801
|
-
trimWhitespace(): Promise<void>;
|
|
802
|
-
deleteDuplicates(): Promise<void>;
|
|
803
|
-
addSlicer(): Promise<void>;
|
|
804
|
-
updateSlicerSpec(): Promise<void>;
|
|
805
|
-
/** delete this worksheet */
|
|
806
|
-
delete(): Promise<void>;
|
|
807
|
-
/**
|
|
808
|
-
* copies this worksheet into another document/spreadsheet
|
|
809
|
-
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.sheets/copyTo
|
|
810
|
-
* */
|
|
811
|
-
copyToSpreadsheet(destinationSpreadsheetId: SpreadsheetId): Promise<any>;
|
|
812
|
-
/** clear data in the sheet - either the entire sheet or a specific range */
|
|
813
|
-
clear(
|
|
814
|
-
/** optional A1 range to clear - defaults to entire sheet */
|
|
815
|
-
a1Range?: A1Range): Promise<void>;
|
|
816
|
-
/** exports worksheet as CSV file (comma-separated values) */
|
|
817
|
-
downloadAsCSV(): Promise<ArrayBuffer>;
|
|
818
|
-
downloadAsCSV(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
819
|
-
downloadAsCSV(returnStreamInsteadOfBuffer: true): Promise<ReadableStream$1>;
|
|
820
|
-
/** exports worksheet as TSC file (tab-separated values) */
|
|
821
|
-
downloadAsTSV(): Promise<ArrayBuffer>;
|
|
822
|
-
downloadAsTSV(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
823
|
-
downloadAsTSV(returnStreamInsteadOfBuffer: true): Promise<ReadableStream$1>;
|
|
824
|
-
/** exports worksheet as PDF */
|
|
825
|
-
downloadAsPDF(): Promise<ArrayBuffer>;
|
|
826
|
-
downloadAsPDF(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
827
|
-
downloadAsPDF(returnStreamInsteadOfBuffer: true): Promise<ReadableStream$1>;
|
|
828
|
-
}
|
|
716
|
+
/** parent GoogleSpreadsheet instance */
|
|
717
|
+
readonly _spreadsheet: GoogleSpreadsheet;
|
|
718
|
+
private _headerRowIndex;
|
|
719
|
+
private _rawProperties;
|
|
720
|
+
private _cells;
|
|
721
|
+
private _rowMetadata;
|
|
722
|
+
private _columnMetadata;
|
|
723
|
+
private _protectedRanges;
|
|
724
|
+
private _headerValues;
|
|
725
|
+
get headerValues(): string[];
|
|
726
|
+
constructor(/** parent GoogleSpreadsheet instance */
|
|
727
|
+
|
|
728
|
+
_spreadsheet: GoogleSpreadsheet, rawProperties: WorksheetProperties, rawCellData?: CellDataRange[], protectedRanges?: ProtectedRange[]);
|
|
729
|
+
updateRawData(properties: WorksheetProperties, rawCellData: CellDataRange[], protectedRanges?: ProtectedRange[]): void;
|
|
730
|
+
_makeSingleUpdateRequest(requestType: string, requestParams: any): Promise<any>;
|
|
731
|
+
private _ensureInfoLoaded;
|
|
732
|
+
/**
|
|
733
|
+
* clear local cache of sheet data/properties
|
|
734
|
+
*/
|
|
735
|
+
resetLocalCache(/** set to true to clear data only, leaving sheet metadata/propeties intact */
|
|
736
|
+
|
|
737
|
+
dataOnly?: boolean): void;
|
|
738
|
+
private _fillCellData;
|
|
739
|
+
private _addSheetIdToRange;
|
|
740
|
+
private _getProp;
|
|
741
|
+
private _setProp;
|
|
742
|
+
get sheetId(): WorksheetProperties["sheetId"];
|
|
743
|
+
get title(): WorksheetProperties["title"];
|
|
744
|
+
get index(): WorksheetProperties["index"];
|
|
745
|
+
get sheetType(): WorksheetProperties["sheetType"];
|
|
746
|
+
get gridProperties(): WorksheetProperties["gridProperties"];
|
|
747
|
+
get hidden(): WorksheetProperties["hidden"];
|
|
748
|
+
get tabColor(): WorksheetProperties["tabColor"];
|
|
749
|
+
get rightToLeft(): WorksheetProperties["rightToLeft"];
|
|
750
|
+
get protectedRanges(): ProtectedRange[] | null;
|
|
751
|
+
private get _headerRange();
|
|
752
|
+
set sheetId(newVal: WorksheetProperties['sheetId']);
|
|
753
|
+
set title(newVal: WorksheetProperties['title']);
|
|
754
|
+
set index(newVal: WorksheetProperties['index']);
|
|
755
|
+
set sheetType(newVal: WorksheetProperties['sheetType']);
|
|
756
|
+
set gridProperties(newVal: WorksheetProperties['gridProperties']);
|
|
757
|
+
set hidden(newVal: WorksheetProperties['hidden']);
|
|
758
|
+
set tabColor(newVal: WorksheetProperties['tabColor']);
|
|
759
|
+
set rightToLeft(newVal: WorksheetProperties['rightToLeft']);
|
|
760
|
+
get rowCount(): number;
|
|
761
|
+
get columnCount(): number;
|
|
762
|
+
get a1SheetName(): string;
|
|
763
|
+
get encodedA1SheetName(): string;
|
|
764
|
+
get lastColumnLetter(): string;
|
|
765
|
+
get cellStats(): {
|
|
766
|
+
nonEmpty: number;
|
|
767
|
+
loaded: number;
|
|
768
|
+
total: number;
|
|
769
|
+
};
|
|
770
|
+
getCellByA1(a1Address: A1Address): GoogleSpreadsheetCell;
|
|
771
|
+
getCell(rowIndex: RowIndex, columnIndex: ColumnIndex): GoogleSpreadsheetCell;
|
|
772
|
+
loadCells(sheetFilters?: DataFilterWithoutWorksheetId | DataFilterWithoutWorksheetId[]): Promise<void>;
|
|
773
|
+
saveUpdatedCells(): Promise<void>;
|
|
774
|
+
saveCells(cellsToUpdate: GoogleSpreadsheetCell[]): Promise<void>;
|
|
775
|
+
_ensureHeaderRowLoaded(): Promise<void>;
|
|
776
|
+
loadHeaderRow(headerRowIndex?: number): Promise<void>;
|
|
777
|
+
private _processHeaderRow;
|
|
778
|
+
setHeaderRow(headerValues: string[], headerRowIndex?: number): Promise<void>;
|
|
779
|
+
addRows(rows: RawRowData[], options?: AddRowOptions): Promise<GoogleSpreadsheetRow<Record<string, any>>[]>;
|
|
780
|
+
/**
|
|
781
|
+
* add a single row - see addRows for more info
|
|
782
|
+
*/
|
|
783
|
+
addRow(rowValues: RawRowData, options?: AddRowOptions): Promise<GoogleSpreadsheetRow<Record<string, any>>>;
|
|
784
|
+
private _rowCache;
|
|
785
|
+
getRows<T extends Record<string, any>>(options?: {
|
|
786
|
+
/** skip first N rows */offset?: number; /** limit number of rows fetched */
|
|
787
|
+
limit?: number;
|
|
788
|
+
}): Promise<GoogleSpreadsheetRow<T>[]>;
|
|
789
|
+
/**
|
|
790
|
+
* @internal
|
|
791
|
+
* Used internally to update row numbers after deleting rows.
|
|
792
|
+
* Should not be called directly.
|
|
793
|
+
* */
|
|
794
|
+
_shiftRowCache(deletedRowNumber: number): void;
|
|
795
|
+
/**
|
|
796
|
+
* @internal
|
|
797
|
+
* Used internally to update row numbers after deleting multiple rows.
|
|
798
|
+
* Should not be called directly.
|
|
799
|
+
* */
|
|
800
|
+
_shiftRowCacheBulk(startIndex: number, endIndex: number): void;
|
|
801
|
+
/**
|
|
802
|
+
* @internal
|
|
803
|
+
* Used internally to shift cell cache after deleting rows.
|
|
804
|
+
* Should not be called directly.
|
|
805
|
+
* */
|
|
806
|
+
_shiftCellCacheRows(startIndex: number, endIndex: number): void;
|
|
807
|
+
/**
|
|
808
|
+
* @internal
|
|
809
|
+
* Used internally to shift cell cache after deleting columns.
|
|
810
|
+
* Should not be called directly.
|
|
811
|
+
* */
|
|
812
|
+
_shiftCellCacheColumns(startIndex: number, endIndex: number): void;
|
|
813
|
+
clearRows(options?: {
|
|
814
|
+
start?: number;
|
|
815
|
+
end?: number;
|
|
816
|
+
}): Promise<void>;
|
|
817
|
+
/** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UpdateSheetPropertiesRequest */
|
|
818
|
+
updateProperties(properties: Partial<Omit<WorksheetProperties, 'sheetId'>>): Promise<any>;
|
|
819
|
+
/**
|
|
820
|
+
* passes through the call to updateProperties to update only the gridProperties object
|
|
821
|
+
*/
|
|
822
|
+
updateGridProperties(gridProperties: Partial<WorksheetGridProperties>): Promise<any>;
|
|
823
|
+
/**
|
|
824
|
+
* resize, internally just calls updateGridProperties
|
|
825
|
+
*/
|
|
826
|
+
resize(gridProperties: Pick<WorksheetGridProperties, 'rowCount' | 'columnCount'>): Promise<any>;
|
|
827
|
+
/**
|
|
828
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#updatedimensionpropertiesrequest
|
|
829
|
+
*/
|
|
830
|
+
updateDimensionProperties(columnsOrRows: WorksheetDimension, properties: WorksheetDimensionProperties, bounds: Partial<DimensionRangeIndexes>): Promise<any>;
|
|
831
|
+
getCellsInRange(a1Range: A1Range, options?: GetValuesRequestOptions): Promise<any>;
|
|
832
|
+
batchGetCellsInRange(a1Ranges: A1Range[], options?: GetValuesRequestOptions): Promise<any>;
|
|
833
|
+
/**
|
|
834
|
+
* Updates an existing named range
|
|
835
|
+
*
|
|
836
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UpdateNamedRangeRequest
|
|
837
|
+
*/
|
|
838
|
+
updateNamedRange(/** ID of the named range to update */
|
|
839
|
+
|
|
840
|
+
namedRangeId: string, /** The named range properties to update */
|
|
841
|
+
|
|
842
|
+
namedRange: Partial<{
|
|
843
|
+
name: string;
|
|
844
|
+
range: GridRangeWithOptionalWorksheetId;
|
|
845
|
+
}>, /** Field mask specifying which properties to update */
|
|
846
|
+
|
|
847
|
+
fields: string): Promise<any>;
|
|
848
|
+
/**
|
|
849
|
+
* Creates a new named range in this worksheet (convenience method that auto-fills sheetId)
|
|
850
|
+
*
|
|
851
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AddNamedRangeRequest
|
|
852
|
+
*/
|
|
853
|
+
addNamedRange(/** Name of the new named range */
|
|
854
|
+
|
|
855
|
+
name: string, /** GridRange describing the range (sheetId optional, will be auto-filled) */
|
|
856
|
+
|
|
857
|
+
range: GridRangeWithOptionalWorksheetId, /** Optional ID for the named range */
|
|
829
858
|
|
|
859
|
+
namedRangeId?: string): Promise<any>;
|
|
860
|
+
/**
|
|
861
|
+
* Deletes a named range (convenience wrapper)
|
|
862
|
+
*
|
|
863
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteNamedRangeRequest
|
|
864
|
+
*/
|
|
865
|
+
deleteNamedRange(/** ID of the named range to delete */
|
|
866
|
+
|
|
867
|
+
namedRangeId: string): Promise<any>;
|
|
868
|
+
/**
|
|
869
|
+
* Updates all cells in a range with the same cell data
|
|
870
|
+
*
|
|
871
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#RepeatCellRequest
|
|
872
|
+
*/
|
|
873
|
+
repeatCell(/** The range to update (sheetId optional) */
|
|
874
|
+
|
|
875
|
+
range: GridRangeWithOptionalWorksheetId, /** The cell data to repeat across the range */
|
|
876
|
+
|
|
877
|
+
cell: any, /** Which fields to update (use "*" for all fields) */
|
|
878
|
+
|
|
879
|
+
fields: string): Promise<void>;
|
|
880
|
+
/**
|
|
881
|
+
* Auto-fills cells with data following a pattern (like dragging the fill handle)
|
|
882
|
+
*
|
|
883
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AutoFillRequest
|
|
884
|
+
*/
|
|
885
|
+
autoFill(/** The range to autofill (detects source location automatically, sheetId optional) or explicit source and destination specification */
|
|
886
|
+
|
|
887
|
+
rangeOrSource: GridRangeWithOptionalWorksheetId | SourceAndDestination, /** Whether to generate data with the alternate series */
|
|
888
|
+
|
|
889
|
+
useAlternateSeries?: boolean): Promise<void>;
|
|
890
|
+
/**
|
|
891
|
+
* Cuts data from a source range and pastes it to a destination coordinate
|
|
892
|
+
*
|
|
893
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#CutPasteRequest
|
|
894
|
+
*/
|
|
895
|
+
cutPaste(/** The source range to cut from (sheetId optional) */
|
|
896
|
+
|
|
897
|
+
source: GridRangeWithOptionalWorksheetId, /** The top-left coordinate where data should be pasted (sheetId optional) */
|
|
898
|
+
|
|
899
|
+
destination: GridCoordinateWithOptionalWorksheetId, /** What kind of data to paste (defaults to PASTE_NORMAL) */
|
|
900
|
+
|
|
901
|
+
pasteType?: PasteType): Promise<void>;
|
|
902
|
+
/**
|
|
903
|
+
* Copies data from a source range and pastes it to a destination range
|
|
904
|
+
*
|
|
905
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#CopyPasteRequest
|
|
906
|
+
*/
|
|
907
|
+
copyPaste(/** The source range to copy from (sheetId optional) */
|
|
908
|
+
|
|
909
|
+
source: GridRangeWithOptionalWorksheetId, /** The destination range to paste to (sheetId optional) */
|
|
910
|
+
|
|
911
|
+
destination: GridRangeWithOptionalWorksheetId, /** What kind of data to paste (defaults to PASTE_NORMAL) */
|
|
912
|
+
|
|
913
|
+
pasteType?: PasteType, /** How data should be oriented (defaults to NORMAL) */
|
|
914
|
+
|
|
915
|
+
pasteOrientation?: PasteOrientation): Promise<void>;
|
|
916
|
+
/**
|
|
917
|
+
* Merges all cells in the range
|
|
918
|
+
*
|
|
919
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#MergeCellsRequest
|
|
920
|
+
*/
|
|
921
|
+
mergeCells(range: GridRangeWithOptionalWorksheetId, mergeType?: string): Promise<void>;
|
|
922
|
+
/**
|
|
923
|
+
* Unmerges cells in the given range
|
|
924
|
+
*
|
|
925
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UnmergeCellsRequest
|
|
926
|
+
*/
|
|
927
|
+
unmergeCells(range: GridRangeWithOptionalWorksheetId): Promise<void>;
|
|
928
|
+
/**
|
|
929
|
+
* Updates borders for a range
|
|
930
|
+
*
|
|
931
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UpdateBordersRequest
|
|
932
|
+
*/
|
|
933
|
+
updateBorders(/** The range whose borders should be updated (sheetId optional) */
|
|
934
|
+
|
|
935
|
+
range: GridRangeWithOptionalWorksheetId, /** Border styles for top, bottom, left, right, innerHorizontal, innerVertical */
|
|
936
|
+
|
|
937
|
+
borders: {
|
|
938
|
+
top?: any;
|
|
939
|
+
bottom?: any;
|
|
940
|
+
left?: any;
|
|
941
|
+
right?: any;
|
|
942
|
+
innerHorizontal?: any;
|
|
943
|
+
innerVertical?: any;
|
|
944
|
+
}): Promise<void>;
|
|
945
|
+
/**
|
|
946
|
+
* Adds a filter view to the sheet
|
|
947
|
+
*
|
|
948
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AddFilterViewRequest
|
|
949
|
+
*/
|
|
950
|
+
addFilterView(/** The filter view to add (filterViewId is optional and will be auto-generated if not provided) */
|
|
951
|
+
|
|
952
|
+
filter: FilterView): Promise<any>;
|
|
953
|
+
/**
|
|
954
|
+
* Appends cells after the last row with data in a sheet
|
|
955
|
+
*
|
|
956
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AppendCellsRequest
|
|
957
|
+
*/
|
|
958
|
+
appendCells(/** The row data to append */
|
|
959
|
+
|
|
960
|
+
rows: any[], /** Which fields to update (use "*" for all fields) */
|
|
961
|
+
|
|
962
|
+
fields: string): Promise<void>;
|
|
963
|
+
/**
|
|
964
|
+
* Clears the basic filter on this sheet
|
|
965
|
+
*
|
|
966
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#ClearBasicFilterRequest
|
|
967
|
+
*/
|
|
968
|
+
clearBasicFilter(): Promise<void>;
|
|
969
|
+
/**
|
|
970
|
+
* Delete rows or columns in a given range
|
|
971
|
+
*
|
|
972
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteDimensionRequest
|
|
973
|
+
*/
|
|
974
|
+
deleteDimension(columnsOrRows: WorksheetDimension, rangeIndexes: DimensionRangeIndexes): Promise<any>;
|
|
975
|
+
/**
|
|
976
|
+
* Delete rows by index
|
|
977
|
+
*/
|
|
978
|
+
deleteRows(/** the start row index (inclusive, 0-based) */
|
|
979
|
+
|
|
980
|
+
startIndex: number, /** the end row index (exclusive) */
|
|
981
|
+
|
|
982
|
+
endIndex: number): Promise<any>;
|
|
983
|
+
/**
|
|
984
|
+
* Delete columns by index
|
|
985
|
+
*/
|
|
986
|
+
deleteColumns(/** the start column index (inclusive, 0-based) */
|
|
987
|
+
|
|
988
|
+
startIndex: number, /** the end column index (exclusive) */
|
|
989
|
+
|
|
990
|
+
endIndex: number): Promise<any>;
|
|
991
|
+
deleteEmbeddedObject(): Promise<void>;
|
|
992
|
+
/**
|
|
993
|
+
* Deletes a filter view from the sheet
|
|
994
|
+
*
|
|
995
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteFilterViewRequest
|
|
996
|
+
*/
|
|
997
|
+
deleteFilterView(/** The ID of the filter view to delete */
|
|
998
|
+
|
|
999
|
+
filterId: Integer): Promise<void>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Duplicates a filter view
|
|
1002
|
+
*
|
|
1003
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DuplicateFilterViewRequest
|
|
1004
|
+
*/
|
|
1005
|
+
duplicateFilterView(/** The ID of the filter view to duplicate */
|
|
1006
|
+
|
|
1007
|
+
filterId: Integer): Promise<void>;
|
|
1008
|
+
/**
|
|
1009
|
+
* Duplicate worksheet within the document
|
|
1010
|
+
*
|
|
1011
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DuplicateSheetRequest
|
|
1012
|
+
*/
|
|
1013
|
+
duplicate(options?: {
|
|
1014
|
+
id?: WorksheetId;
|
|
1015
|
+
title?: string;
|
|
1016
|
+
index?: number;
|
|
1017
|
+
}): Promise<GoogleSpreadsheetWorksheet>;
|
|
1018
|
+
/**
|
|
1019
|
+
* Finds and replaces text in cells
|
|
1020
|
+
*
|
|
1021
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#FindReplaceRequest
|
|
1022
|
+
*/
|
|
1023
|
+
findReplace(/** The value to search for */
|
|
1024
|
+
|
|
1025
|
+
find: string, /** The value to use as replacement */
|
|
1026
|
+
|
|
1027
|
+
replacement: string, /** Search options (matchCase, matchEntireCell, searchByRegex, includeFormulas) */
|
|
1028
|
+
|
|
1029
|
+
options?: {
|
|
1030
|
+
matchCase?: boolean;
|
|
1031
|
+
matchEntireCell?: boolean;
|
|
1032
|
+
searchByRegex?: boolean;
|
|
1033
|
+
includeFormulas?: boolean;
|
|
1034
|
+
}, /** Optional range to search in (defaults to entire sheet, sheetId optional) */
|
|
1035
|
+
|
|
1036
|
+
range?: GridRangeWithOptionalWorksheetId): Promise<void>;
|
|
1037
|
+
/**
|
|
1038
|
+
* Inserts rows or columns at a particular index
|
|
1039
|
+
*
|
|
1040
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#InsertDimensionRequest
|
|
1041
|
+
*/
|
|
1042
|
+
insertDimension(columnsOrRows: WorksheetDimension, rangeIndexes: DimensionRangeIndexes, inheritFromBefore?: boolean): Promise<any>;
|
|
1043
|
+
/**
|
|
1044
|
+
* insert empty cells in a range, shifting existing cells in the specified direction
|
|
1045
|
+
*
|
|
1046
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#InsertRangeRequest
|
|
1047
|
+
*/
|
|
1048
|
+
insertRange(/** the range to insert new cells into */
|
|
1049
|
+
|
|
1050
|
+
range: GridRangeWithOptionalWorksheetId, /** which direction to shift existing cells - ROWS (shift down) or COLUMNS (shift right) */
|
|
1051
|
+
|
|
1052
|
+
shiftDimension: WorksheetDimension): Promise<void>;
|
|
1053
|
+
/**
|
|
1054
|
+
* Moves rows or columns to a different position within the sheet
|
|
1055
|
+
*
|
|
1056
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#MoveDimensionRequest
|
|
1057
|
+
*/
|
|
1058
|
+
moveDimension(/** Whether to move rows or columns */
|
|
1059
|
+
|
|
1060
|
+
dimension: WorksheetDimension, /** The indexes of rows/columns to move */
|
|
1061
|
+
|
|
1062
|
+
source: DimensionRangeIndexes, /** Where to move them (calculated before removal) */
|
|
1063
|
+
|
|
1064
|
+
destinationIndex: number): Promise<void>;
|
|
1065
|
+
updateEmbeddedObjectPosition(): Promise<void>;
|
|
1066
|
+
/**
|
|
1067
|
+
* Inserts data into the spreadsheet starting at the specified coordinate
|
|
1068
|
+
*
|
|
1069
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#PasteDataRequest
|
|
1070
|
+
*/
|
|
1071
|
+
pasteData(/** The coordinate at which the data should start being inserted (sheetId optional) */
|
|
1072
|
+
|
|
1073
|
+
coordinate: GridCoordinateWithOptionalWorksheetId, /** The data to insert */
|
|
1074
|
+
|
|
1075
|
+
data: string, /** The delimiter in the data */
|
|
1076
|
+
|
|
1077
|
+
delimiter: string, /** How the data should be pasted (defaults to PASTE_NORMAL) */
|
|
1078
|
+
|
|
1079
|
+
type?: PasteType): Promise<void>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Splits a column of text into multiple columns based on a delimiter
|
|
1082
|
+
*
|
|
1083
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#TextToColumnsRequest
|
|
1084
|
+
*/
|
|
1085
|
+
textToColumns(/** The column to split (must span exactly one column) */
|
|
1086
|
+
|
|
1087
|
+
source: GridRangeWithOptionalWorksheetId, /** Type of delimiter to use */
|
|
1088
|
+
|
|
1089
|
+
delimiterType: DelimiterType, /** Custom delimiter character (only used when delimiterType is CUSTOM) */
|
|
1090
|
+
|
|
1091
|
+
delimiter?: string): Promise<void>;
|
|
1092
|
+
/**
|
|
1093
|
+
* Updates properties of a filter view
|
|
1094
|
+
*
|
|
1095
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UpdateFilterViewRequest
|
|
1096
|
+
*/
|
|
1097
|
+
updateFilterView(/** The new properties of the filter view */
|
|
1098
|
+
|
|
1099
|
+
filter: FilterView, /** The fields that should be updated (use "*" to update all fields) */
|
|
1100
|
+
|
|
1101
|
+
fields: string): Promise<void>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Deletes a range of cells and shifts remaining cells
|
|
1104
|
+
*
|
|
1105
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteRangeRequest
|
|
1106
|
+
*/
|
|
1107
|
+
deleteRange(/** The range of cells to delete (sheetId optional) */
|
|
1108
|
+
|
|
1109
|
+
range: GridRangeWithOptionalWorksheetId, /** How remaining cells should shift (ROWS = up, COLUMNS = left) */
|
|
1110
|
+
|
|
1111
|
+
shiftDimension: WorksheetDimension): Promise<void>;
|
|
1112
|
+
/**
|
|
1113
|
+
* Appends rows or columns to the end of a sheet
|
|
1114
|
+
*
|
|
1115
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AppendDimensionRequest
|
|
1116
|
+
*/
|
|
1117
|
+
appendDimension(/** Whether rows or columns should be appended */
|
|
1118
|
+
|
|
1119
|
+
dimension: WorksheetDimension, /** The number of rows or columns to append */
|
|
1120
|
+
|
|
1121
|
+
length: number): Promise<void>;
|
|
1122
|
+
/**
|
|
1123
|
+
* Adds a new conditional formatting rule at the given index
|
|
1124
|
+
* All subsequent rules' indexes are incremented
|
|
1125
|
+
*
|
|
1126
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AddConditionalFormatRuleRequest
|
|
1127
|
+
*/
|
|
1128
|
+
addConditionalFormatRule(/** The rule to add */
|
|
1129
|
+
|
|
1130
|
+
rule: ConditionalFormatRule, /** The zero-based index where the rule should be inserted */
|
|
1131
|
+
|
|
1132
|
+
index: Integer): Promise<void>;
|
|
1133
|
+
/**
|
|
1134
|
+
* Updates a conditional format rule at the given index, or moves a conditional format rule to another index
|
|
1135
|
+
*
|
|
1136
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UpdateConditionalFormatRuleRequest
|
|
1137
|
+
*/
|
|
1138
|
+
updateConditionalFormatRule(/** Either provide `rule` to replace the rule, or `newIndex` and `sheetId` to move it */
|
|
1139
|
+
|
|
1140
|
+
options: {
|
|
1141
|
+
/** The zero-based index of the rule */index: Integer; /** The rule that should replace the rule at the given index (mutually exclusive with newIndex) */
|
|
1142
|
+
rule?: ConditionalFormatRule; /** The zero-based new index the rule should end up at (mutually exclusive with rule, requires sheetId) */
|
|
1143
|
+
newIndex?: Integer; /** The sheet of the rule to move (required if newIndex is set) */
|
|
1144
|
+
sheetId?: WorksheetId;
|
|
1145
|
+
}): Promise<void>;
|
|
1146
|
+
/**
|
|
1147
|
+
* Deletes a conditional format rule at the given index
|
|
1148
|
+
* All subsequent rules' indexes are decremented
|
|
1149
|
+
*
|
|
1150
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteConditionalFormatRuleRequest
|
|
1151
|
+
*/
|
|
1152
|
+
deleteConditionalFormatRule(/** The zero-based index of the rule to be deleted */
|
|
1153
|
+
|
|
1154
|
+
index: Integer, /** The sheet the rule is being deleted from (defaults to this sheet) */
|
|
1155
|
+
|
|
1156
|
+
sheetId?: WorksheetId): Promise<void>;
|
|
1157
|
+
/**
|
|
1158
|
+
* Sorts data in rows based on sort order per column
|
|
1159
|
+
*
|
|
1160
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#SortRangeRequest
|
|
1161
|
+
*/
|
|
1162
|
+
sortRange(/** The range to sort (sheetId optional) */
|
|
1163
|
+
|
|
1164
|
+
range: GridRangeWithOptionalWorksheetId, /** Array of sort specifications (later specs used when values are equal) */
|
|
1165
|
+
|
|
1166
|
+
sortSpecs: SortSpec[]): Promise<void>;
|
|
1167
|
+
/**
|
|
1168
|
+
* Sets (or unsets) a data validation rule to every cell in the range
|
|
1169
|
+
*
|
|
1170
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#SetDataValidationRequest
|
|
1171
|
+
*/
|
|
1172
|
+
setDataValidation(range: GridRangeWithOptionalWorksheetId, /** data validation rule object, or set to false to clear an existing rule */
|
|
1173
|
+
|
|
1174
|
+
rule: DataValidationRule | false): Promise<any>;
|
|
1175
|
+
/**
|
|
1176
|
+
* Sets the basic filter on this sheet
|
|
1177
|
+
*
|
|
1178
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#SetBasicFilterRequest
|
|
1179
|
+
*/
|
|
1180
|
+
setBasicFilter(/** The basic filter configuration (range will auto-fill sheetId if not provided) */
|
|
1181
|
+
|
|
1182
|
+
filter: {
|
|
1183
|
+
range?: GridRangeWithOptionalWorksheetId;
|
|
1184
|
+
sortSpecs?: SortSpec[];
|
|
1185
|
+
filterSpecs?: any[];
|
|
1186
|
+
}): Promise<void>;
|
|
1187
|
+
/**
|
|
1188
|
+
* add a new protected range to the sheet
|
|
1189
|
+
*
|
|
1190
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AddProtectedRangeRequest
|
|
1191
|
+
*/
|
|
1192
|
+
addProtectedRange(protectedRange: ProtectedRange): Promise<any>;
|
|
1193
|
+
/**
|
|
1194
|
+
* update an existing protected range
|
|
1195
|
+
*
|
|
1196
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UpdateProtectedRangeRequest
|
|
1197
|
+
*/
|
|
1198
|
+
updateProtectedRange(protectedRangeId: Integer, protectedRange: Partial<ProtectedRange>): Promise<any>;
|
|
1199
|
+
/**
|
|
1200
|
+
* delete a protected range by ID
|
|
1201
|
+
*
|
|
1202
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteProtectedRangeRequest
|
|
1203
|
+
*/
|
|
1204
|
+
deleteProtectedRange(protectedRangeId: Integer): Promise<any>;
|
|
1205
|
+
/**
|
|
1206
|
+
* auto-resize rows or columns to fit their contents
|
|
1207
|
+
*
|
|
1208
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AutoResizeDimensionsRequest
|
|
1209
|
+
*/
|
|
1210
|
+
autoResizeDimensions(/** which dimension to auto-resize */
|
|
1211
|
+
|
|
1212
|
+
columnsOrRows: WorksheetDimension, /** start and end indexes (optional, defaults to all) */
|
|
1213
|
+
|
|
1214
|
+
rangeIndexes?: DimensionRangeIndexes): Promise<any>;
|
|
1215
|
+
addChart(): Promise<void>;
|
|
1216
|
+
updateChartSpec(): Promise<void>;
|
|
1217
|
+
/**
|
|
1218
|
+
* Updates properties of a banded range
|
|
1219
|
+
*
|
|
1220
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UpdateBandingRequest
|
|
1221
|
+
*/
|
|
1222
|
+
updateBanding(/** The banded range to update with the new properties */
|
|
1223
|
+
|
|
1224
|
+
bandedRange: BandedRange, /** The fields that should be updated (use "*" to update all fields) */
|
|
1225
|
+
|
|
1226
|
+
fields: string): Promise<void>;
|
|
1227
|
+
/**
|
|
1228
|
+
* Adds a new banded range to the sheet
|
|
1229
|
+
*
|
|
1230
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AddBandingRequest
|
|
1231
|
+
*/
|
|
1232
|
+
addBanding(/** The banded range to add (bandedRangeId is optional and will be auto-generated if not provided) */
|
|
1233
|
+
|
|
1234
|
+
bandedRange: BandedRange): Promise<any>;
|
|
1235
|
+
/**
|
|
1236
|
+
* Deletes a banded range from the sheet
|
|
1237
|
+
*
|
|
1238
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteBandingRequest
|
|
1239
|
+
*/
|
|
1240
|
+
deleteBanding(/** The ID of the banded range to delete */
|
|
1241
|
+
|
|
1242
|
+
bandedRangeId: Integer): Promise<void>;
|
|
1243
|
+
/**
|
|
1244
|
+
* Creates developer metadata
|
|
1245
|
+
*
|
|
1246
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#CreateDeveloperMetadataRequest
|
|
1247
|
+
*/
|
|
1248
|
+
createDeveloperMetadata(/** The developer metadata to create */
|
|
1249
|
+
|
|
1250
|
+
developerMetadata: DeveloperMetadata): Promise<any>;
|
|
1251
|
+
/**
|
|
1252
|
+
* Updates developer metadata that matches the specified filters
|
|
1253
|
+
*
|
|
1254
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UpdateDeveloperMetadataRequest
|
|
1255
|
+
*/
|
|
1256
|
+
updateDeveloperMetadata(/** The filters matching the developer metadata entries to update */
|
|
1257
|
+
|
|
1258
|
+
dataFilters: DataFilterObject[], /** The value that all metadata matched by the filters will be updated to */
|
|
1259
|
+
|
|
1260
|
+
developerMetadata: DeveloperMetadata, /** The fields that should be updated (use "*" to update all fields) */
|
|
1261
|
+
|
|
1262
|
+
fields: string): Promise<void>;
|
|
1263
|
+
/**
|
|
1264
|
+
* Deletes developer metadata that matches the specified filter
|
|
1265
|
+
*
|
|
1266
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteDeveloperMetadataRequest
|
|
1267
|
+
*/
|
|
1268
|
+
deleteDeveloperMetadata(/** The filter describing the criteria used to select which developer metadata to delete */
|
|
1269
|
+
|
|
1270
|
+
dataFilter: DataFilterObject): Promise<void>;
|
|
1271
|
+
/**
|
|
1272
|
+
* Randomizes the order of rows in a range
|
|
1273
|
+
*
|
|
1274
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#RandomizeRangeRequest
|
|
1275
|
+
*/
|
|
1276
|
+
randomizeRange(/** The range to randomize (sheetId optional) */
|
|
1277
|
+
|
|
1278
|
+
range: GridRangeWithOptionalWorksheetId): Promise<void>;
|
|
1279
|
+
addDimensionGroup(): Promise<void>;
|
|
1280
|
+
deleteDimensionGroup(): Promise<void>;
|
|
1281
|
+
updateDimensionGroup(): Promise<void>;
|
|
1282
|
+
/**
|
|
1283
|
+
* Trims whitespace from the start and end of each cell's text
|
|
1284
|
+
*
|
|
1285
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#TrimWhitespaceRequest
|
|
1286
|
+
*/
|
|
1287
|
+
trimWhitespace(/** The range whose cells to trim (sheetId optional) */
|
|
1288
|
+
|
|
1289
|
+
range: GridRangeWithOptionalWorksheetId): Promise<void>;
|
|
1290
|
+
/**
|
|
1291
|
+
* Removes duplicate rows from a range based on specified columns
|
|
1292
|
+
*
|
|
1293
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteDuplicatesRequest
|
|
1294
|
+
*/
|
|
1295
|
+
deleteDuplicates(/** The range to remove duplicates from (sheetId optional) */
|
|
1296
|
+
|
|
1297
|
+
range: GridRangeWithOptionalWorksheetId, /** Columns to check for duplicates (if empty, all columns are used) */
|
|
1298
|
+
|
|
1299
|
+
comparisonColumns?: DimensionRange[]): Promise<void>;
|
|
1300
|
+
addSlicer(): Promise<void>;
|
|
1301
|
+
updateSlicerSpec(): Promise<void>;
|
|
1302
|
+
/**
|
|
1303
|
+
* delete this worksheet
|
|
1304
|
+
*/
|
|
1305
|
+
delete(): Promise<void>;
|
|
1306
|
+
/**
|
|
1307
|
+
* copies this worksheet into another document/spreadsheet
|
|
1308
|
+
*
|
|
1309
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.sheets/copyTo
|
|
1310
|
+
*/
|
|
1311
|
+
copyToSpreadsheet(destinationSpreadsheetId: SpreadsheetId): Promise<any>;
|
|
1312
|
+
/**
|
|
1313
|
+
* clear data in the sheet - either the entire sheet or a specific range
|
|
1314
|
+
*/
|
|
1315
|
+
clear(/** optional A1 range to clear - defaults to entire sheet */
|
|
1316
|
+
|
|
1317
|
+
a1Range?: A1Range): Promise<void>;
|
|
1318
|
+
/**
|
|
1319
|
+
* exports worksheet as CSV file (comma-separated values)
|
|
1320
|
+
*/
|
|
1321
|
+
downloadAsCSV(): Promise<ArrayBuffer>;
|
|
1322
|
+
downloadAsCSV(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
1323
|
+
downloadAsCSV(returnStreamInsteadOfBuffer: true): Promise<ReadableStream$1>;
|
|
1324
|
+
/**
|
|
1325
|
+
* exports worksheet as TSC file (tab-separated values)
|
|
1326
|
+
*/
|
|
1327
|
+
downloadAsTSV(): Promise<ArrayBuffer>;
|
|
1328
|
+
downloadAsTSV(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
1329
|
+
downloadAsTSV(returnStreamInsteadOfBuffer: true): Promise<ReadableStream$1>;
|
|
1330
|
+
/**
|
|
1331
|
+
* exports worksheet as PDF
|
|
1332
|
+
*/
|
|
1333
|
+
downloadAsPDF(): Promise<ArrayBuffer>;
|
|
1334
|
+
downloadAsPDF(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
1335
|
+
downloadAsPDF(returnStreamInsteadOfBuffer: true): Promise<ReadableStream$1>;
|
|
1336
|
+
}
|
|
1337
|
+
//#endregion
|
|
1338
|
+
//#region src/lib/types/drive-types.d.ts
|
|
830
1339
|
type PermissionRoles = 'owner' | 'writer' | 'commenter' | 'reader';
|
|
831
1340
|
type PublicPermissionRoles = Exclude<PermissionRoles, 'owner'>;
|
|
832
1341
|
type PublicPermissionListEntry = {
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
1342
|
+
id: 'anyoneWithLink';
|
|
1343
|
+
type: 'anyone';
|
|
1344
|
+
role: PublicPermissionRoles;
|
|
836
1345
|
};
|
|
837
1346
|
type UserOrGroupPermissionListEntry = {
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
1347
|
+
id: string;
|
|
1348
|
+
displayName: string;
|
|
1349
|
+
type: 'user' | 'group';
|
|
1350
|
+
photoLink?: string;
|
|
1351
|
+
emailAddress: string;
|
|
1352
|
+
role: PermissionRoles;
|
|
1353
|
+
deleted: boolean;
|
|
845
1354
|
};
|
|
846
1355
|
type DomainPermissionListEntry = {
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
1356
|
+
id: string;
|
|
1357
|
+
displayName: string;
|
|
1358
|
+
type: 'domain';
|
|
1359
|
+
domain: string;
|
|
1360
|
+
role: PublicPermissionRoles;
|
|
1361
|
+
photoLink?: string;
|
|
853
1362
|
};
|
|
854
1363
|
type PermissionsList = (PublicPermissionListEntry | UserOrGroupPermissionListEntry | DomainPermissionListEntry)[];
|
|
855
|
-
|
|
1364
|
+
//#endregion
|
|
1365
|
+
//#region src/lib/types/auth-types.d.ts
|
|
856
1366
|
/** single type to handle all valid auth types */
|
|
857
1367
|
type GoogleApiAuth = {
|
|
858
|
-
|
|
1368
|
+
getRequestHeaders: () => Promise<any>;
|
|
859
1369
|
} | {
|
|
860
|
-
|
|
1370
|
+
apiKey: string;
|
|
861
1371
|
} | {
|
|
862
|
-
|
|
1372
|
+
token: string;
|
|
863
1373
|
};
|
|
864
1374
|
declare enum AUTH_MODES {
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
1375
|
+
GOOGLE_AUTH_CLIENT = "google_auth",
|
|
1376
|
+
RAW_ACCESS_TOKEN = "raw_access_token",
|
|
1377
|
+
API_KEY = "api_key"
|
|
868
1378
|
}
|
|
869
|
-
|
|
1379
|
+
//#endregion
|
|
1380
|
+
//#region src/lib/GoogleSpreadsheet.d.ts
|
|
870
1381
|
declare const EXPORT_CONFIG: Record<string, {
|
|
871
|
-
|
|
1382
|
+
singleWorksheet?: boolean;
|
|
872
1383
|
}>;
|
|
873
1384
|
type ExportFileTypes = keyof typeof EXPORT_CONFIG;
|
|
874
1385
|
/**
|
|
@@ -880,159 +1391,164 @@ type ExportFileTypes = keyof typeof EXPORT_CONFIG;
|
|
|
880
1391
|
*
|
|
881
1392
|
*/
|
|
882
1393
|
declare class GoogleSpreadsheet {
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
name: string,
|
|
970
|
-
/** GridRange object describing range */
|
|
971
|
-
range: GridRange,
|
|
972
|
-
/** id for named range (optional) */
|
|
973
|
-
namedRangeId?: string): Promise<any>;
|
|
974
|
-
/**
|
|
975
|
-
* delete a named range
|
|
976
|
-
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteNamedRangeRequest
|
|
977
|
-
* */
|
|
978
|
-
deleteNamedRange(
|
|
979
|
-
/** id of named range to delete */
|
|
980
|
-
namedRangeId: NamedRangeId): Promise<any>;
|
|
981
|
-
/** fetch cell data into local cache */
|
|
982
|
-
loadCells(
|
|
983
|
-
/**
|
|
984
|
-
* single filter or array of filters
|
|
985
|
-
* strings are treated as A1 ranges, objects are treated as GridRange objects
|
|
986
|
-
* pass nothing to fetch all cells
|
|
987
|
-
* */
|
|
988
|
-
filters?: DataFilter | DataFilter[]): Promise<void>;
|
|
989
|
-
/**
|
|
990
|
-
* export/download helper, not meant to be called directly (use downloadAsX methods on spreadsheet and worksheet instead)
|
|
991
|
-
* @internal
|
|
992
|
-
*/
|
|
993
|
-
_downloadAs(fileType: ExportFileTypes, worksheetId: WorksheetId | undefined, returnStreamInsteadOfBuffer?: boolean): Promise<ArrayBuffer | stream_web.ReadableStream<any> | null>;
|
|
994
|
-
/**
|
|
995
|
-
* exports entire document as html file (zipped)
|
|
996
|
-
* @topic export
|
|
997
|
-
* */
|
|
998
|
-
downloadAsZippedHTML(): Promise<ArrayBuffer>;
|
|
999
|
-
downloadAsZippedHTML(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
1000
|
-
downloadAsZippedHTML(returnStreamInsteadOfBuffer: true): Promise<ReadableStream>;
|
|
1001
|
-
/**
|
|
1002
|
-
* @deprecated
|
|
1003
|
-
* use `doc.downloadAsZippedHTML()` instead
|
|
1004
|
-
* */
|
|
1005
|
-
downloadAsHTML(returnStreamInsteadOfBuffer?: boolean): Promise<ArrayBuffer | stream_web.ReadableStream<any> | null>;
|
|
1006
|
-
/**
|
|
1007
|
-
* exports entire document as xlsx spreadsheet (Microsoft Office Excel)
|
|
1008
|
-
* @topic export
|
|
1009
|
-
* */
|
|
1010
|
-
downloadAsXLSX(): Promise<ArrayBuffer>;
|
|
1011
|
-
downloadAsXLSX(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
1012
|
-
downloadAsXLSX(returnStreamInsteadOfBuffer: true): Promise<ReadableStream>;
|
|
1013
|
-
/**
|
|
1014
|
-
* exports entire document as ods spreadsheet (Open Office)
|
|
1015
|
-
* @topic export
|
|
1016
|
-
*/
|
|
1017
|
-
downloadAsODS(): Promise<ArrayBuffer>;
|
|
1018
|
-
downloadAsODS(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
1019
|
-
downloadAsODS(returnStreamInsteadOfBuffer: true): Promise<ReadableStream>;
|
|
1020
|
-
delete(): Promise<void>;
|
|
1021
|
-
/**
|
|
1022
|
-
* list all permissions entries for doc
|
|
1023
|
-
*/
|
|
1024
|
-
listPermissions(): Promise<PermissionsList>;
|
|
1025
|
-
setPublicAccessLevel(role: PublicPermissionRoles | false): Promise<void>;
|
|
1026
|
-
/** share document to email or domain */
|
|
1027
|
-
share(emailAddressOrDomain: string, opts?: {
|
|
1028
|
-
/** set role level, defaults to owner */
|
|
1029
|
-
role?: PermissionRoles;
|
|
1030
|
-
/** set to true if email is for a group */
|
|
1031
|
-
isGroup?: boolean;
|
|
1032
|
-
/** set to string to include a custom message, set to false to skip sending a notification altogether */
|
|
1033
|
-
emailMessage?: string | false;
|
|
1034
|
-
}): Promise<unknown>;
|
|
1035
|
-
static createNewSpreadsheetDocument(auth: GoogleApiAuth, properties?: Partial<SpreadsheetProperties>): Promise<GoogleSpreadsheet>;
|
|
1036
|
-
}
|
|
1394
|
+
readonly spreadsheetId: string;
|
|
1395
|
+
auth: GoogleApiAuth;
|
|
1396
|
+
get authMode(): AUTH_MODES;
|
|
1397
|
+
private _rawSheets;
|
|
1398
|
+
private _rawProperties;
|
|
1399
|
+
private _spreadsheetUrl;
|
|
1400
|
+
private _deleted;
|
|
1401
|
+
/**
|
|
1402
|
+
* Sheets API [ky](https://github.com/sindresorhus/ky?tab=readme-ov-file#kycreatedefaultoptions) instance
|
|
1403
|
+
* authentication is automatically attached
|
|
1404
|
+
* can be used if unsupported sheets calls need to be made
|
|
1405
|
+
* @see https://developers.google.com/sheets/api/reference/rest
|
|
1406
|
+
* */
|
|
1407
|
+
readonly sheetsApi: KyInstance;
|
|
1408
|
+
/**
|
|
1409
|
+
* Drive API [ky](https://github.com/sindresorhus/ky?tab=readme-ov-file#kycreatedefaultoptions) instance
|
|
1410
|
+
* authentication automatically attached
|
|
1411
|
+
* can be used if unsupported drive calls need to be made
|
|
1412
|
+
* @topic permissions
|
|
1413
|
+
* @see https://developers.google.com/drive/api/v3/reference
|
|
1414
|
+
* */
|
|
1415
|
+
readonly driveApi: KyInstance;
|
|
1416
|
+
/**
|
|
1417
|
+
* initialize new GoogleSpreadsheet
|
|
1418
|
+
* @category Initialization
|
|
1419
|
+
* */
|
|
1420
|
+
constructor(/** id of google spreadsheet doc */
|
|
1421
|
+
|
|
1422
|
+
spreadsheetId: SpreadsheetId, /** authentication to use with Google Sheets API */
|
|
1423
|
+
|
|
1424
|
+
auth: GoogleApiAuth);
|
|
1425
|
+
/** @internal */
|
|
1426
|
+
_setAuthRequestHook(req: Request): Promise<Request>;
|
|
1427
|
+
/** @internal */
|
|
1428
|
+
_errorHook(error: HTTPError): Promise<HTTPError<unknown>>;
|
|
1429
|
+
/** @internal */
|
|
1430
|
+
_makeSingleUpdateRequest(requestType: string, requestParams: any): Promise<any>;
|
|
1431
|
+
/** @internal */
|
|
1432
|
+
_makeBatchUpdateRequest(requests: any[], responseRanges?: string | string[]): Promise<void>;
|
|
1433
|
+
/** @internal */
|
|
1434
|
+
_ensureInfoLoaded(): void;
|
|
1435
|
+
/** @internal */
|
|
1436
|
+
_updateRawProperties(newProperties: SpreadsheetProperties): void;
|
|
1437
|
+
/** @internal */
|
|
1438
|
+
_updateOrCreateSheet(sheetInfo: {
|
|
1439
|
+
properties: WorksheetProperties;
|
|
1440
|
+
data: any;
|
|
1441
|
+
protectedRanges?: ProtectedRange[];
|
|
1442
|
+
}): void;
|
|
1443
|
+
_getProp(param: keyof SpreadsheetProperties): any;
|
|
1444
|
+
get title(): SpreadsheetProperties['title'];
|
|
1445
|
+
get locale(): SpreadsheetProperties['locale'];
|
|
1446
|
+
get timeZone(): SpreadsheetProperties['timeZone'];
|
|
1447
|
+
get autoRecalc(): SpreadsheetProperties['autoRecalc'];
|
|
1448
|
+
get defaultFormat(): SpreadsheetProperties['defaultFormat'];
|
|
1449
|
+
get spreadsheetTheme(): SpreadsheetProperties['spreadsheetTheme'];
|
|
1450
|
+
get iterativeCalculationSettings(): SpreadsheetProperties['iterativeCalculationSettings'];
|
|
1451
|
+
/**
|
|
1452
|
+
* update spreadsheet properties
|
|
1453
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets#SpreadsheetProperties
|
|
1454
|
+
* */
|
|
1455
|
+
updateProperties(properties: Partial<SpreadsheetProperties>): Promise<void>;
|
|
1456
|
+
loadInfo(includeCells?: boolean): Promise<void>;
|
|
1457
|
+
resetLocalCache(): void;
|
|
1458
|
+
get sheetCount(): number;
|
|
1459
|
+
get sheetsById(): Record<WorksheetId, GoogleSpreadsheetWorksheet>;
|
|
1460
|
+
get sheetsByIndex(): GoogleSpreadsheetWorksheet[];
|
|
1461
|
+
get sheetsByTitle(): Record<string, GoogleSpreadsheetWorksheet>;
|
|
1462
|
+
/**
|
|
1463
|
+
* Add new worksheet to document
|
|
1464
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AddSheetRequest
|
|
1465
|
+
* */
|
|
1466
|
+
addSheet(properties?: Partial<RecursivePartial<WorksheetProperties> & {
|
|
1467
|
+
headerValues: string[];
|
|
1468
|
+
headerRowIndex: number;
|
|
1469
|
+
}>): Promise<GoogleSpreadsheetWorksheet>;
|
|
1470
|
+
/**
|
|
1471
|
+
* delete a worksheet
|
|
1472
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteSheetRequest
|
|
1473
|
+
* */
|
|
1474
|
+
deleteSheet(sheetId: WorksheetId): Promise<void>;
|
|
1475
|
+
/**
|
|
1476
|
+
* create a new named range
|
|
1477
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AddNamedRangeRequest
|
|
1478
|
+
*/
|
|
1479
|
+
addNamedRange(/** name of new named range */
|
|
1037
1480
|
|
|
1481
|
+
name: string, /** GridRange object describing range */
|
|
1482
|
+
|
|
1483
|
+
range: GridRange, /** id for named range (optional) */
|
|
1484
|
+
|
|
1485
|
+
namedRangeId?: string): Promise<any>;
|
|
1486
|
+
/**
|
|
1487
|
+
* delete a named range
|
|
1488
|
+
* @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteNamedRangeRequest
|
|
1489
|
+
* */
|
|
1490
|
+
deleteNamedRange(/** id of named range to delete */
|
|
1491
|
+
|
|
1492
|
+
namedRangeId: NamedRangeId): Promise<any>;
|
|
1493
|
+
/** fetch cell data into local cache */
|
|
1494
|
+
loadCells(
|
|
1495
|
+
/**
|
|
1496
|
+
* single filter or array of filters
|
|
1497
|
+
* strings are treated as A1 ranges, objects are treated as GridRange objects
|
|
1498
|
+
* pass nothing to fetch all cells
|
|
1499
|
+
* */
|
|
1500
|
+
|
|
1501
|
+
filters?: DataFilter | DataFilter[]): Promise<void>;
|
|
1502
|
+
/**
|
|
1503
|
+
* export/download helper, not meant to be called directly (use downloadAsX methods on spreadsheet and worksheet instead)
|
|
1504
|
+
* @internal
|
|
1505
|
+
*/
|
|
1506
|
+
_downloadAs(fileType: ExportFileTypes, worksheetId: WorksheetId | undefined, returnStreamInsteadOfBuffer?: boolean): Promise<ArrayBuffer | node_stream_web0.ReadableStream<any> | null>;
|
|
1507
|
+
/**
|
|
1508
|
+
* exports entire document as html file (zipped)
|
|
1509
|
+
* @topic export
|
|
1510
|
+
* */
|
|
1511
|
+
downloadAsZippedHTML(): Promise<ArrayBuffer>;
|
|
1512
|
+
downloadAsZippedHTML(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
1513
|
+
downloadAsZippedHTML(returnStreamInsteadOfBuffer: true): Promise<ReadableStream>;
|
|
1514
|
+
/**
|
|
1515
|
+
* @deprecated
|
|
1516
|
+
* use `doc.downloadAsZippedHTML()` instead
|
|
1517
|
+
* */
|
|
1518
|
+
downloadAsHTML(returnStreamInsteadOfBuffer?: boolean): Promise<ArrayBuffer | node_stream_web0.ReadableStream<any> | null>;
|
|
1519
|
+
/**
|
|
1520
|
+
* exports entire document as xlsx spreadsheet (Microsoft Office Excel)
|
|
1521
|
+
* @topic export
|
|
1522
|
+
* */
|
|
1523
|
+
downloadAsXLSX(): Promise<ArrayBuffer>;
|
|
1524
|
+
downloadAsXLSX(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
1525
|
+
downloadAsXLSX(returnStreamInsteadOfBuffer: true): Promise<ReadableStream>;
|
|
1526
|
+
/**
|
|
1527
|
+
* exports entire document as ods spreadsheet (Open Office)
|
|
1528
|
+
* @topic export
|
|
1529
|
+
*/
|
|
1530
|
+
downloadAsODS(): Promise<ArrayBuffer>;
|
|
1531
|
+
downloadAsODS(returnStreamInsteadOfBuffer: false): Promise<ArrayBuffer>;
|
|
1532
|
+
downloadAsODS(returnStreamInsteadOfBuffer: true): Promise<ReadableStream>;
|
|
1533
|
+
delete(): Promise<void>;
|
|
1534
|
+
/**
|
|
1535
|
+
* list all permissions entries for doc
|
|
1536
|
+
*/
|
|
1537
|
+
listPermissions(): Promise<PermissionsList>;
|
|
1538
|
+
setPublicAccessLevel(role: PublicPermissionRoles | false): Promise<void>;
|
|
1539
|
+
/** share document to email or domain */
|
|
1540
|
+
share(emailAddressOrDomain: string, opts?: {
|
|
1541
|
+
/** set role level, defaults to owner */role?: PermissionRoles; /** set to true if email is for a group */
|
|
1542
|
+
isGroup?: boolean; /** set to string to include a custom message, set to false to skip sending a notification altogether */
|
|
1543
|
+
emailMessage?: string | false;
|
|
1544
|
+
}): Promise<unknown>;
|
|
1545
|
+
/**
|
|
1546
|
+
* delete a permission by its ID
|
|
1547
|
+
* @see https://developers.google.com/drive/api/v3/reference/permissions/delete
|
|
1548
|
+
*/
|
|
1549
|
+
deletePermission(permissionId: string): Promise<void>;
|
|
1550
|
+
static createNewSpreadsheetDocument(auth: GoogleApiAuth, properties?: Partial<SpreadsheetProperties>): Promise<GoogleSpreadsheet>;
|
|
1551
|
+
}
|
|
1552
|
+
//#endregion
|
|
1038
1553
|
export { GoogleSpreadsheet, GoogleSpreadsheetCell, GoogleSpreadsheetCellErrorValue, GoogleSpreadsheetRow, GoogleSpreadsheetWorksheet };
|
|
1554
|
+
//# sourceMappingURL=index.d.cts.map
|