forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
google-apps-script.spreadsheet.d.ts
918 lines (895 loc) · 43 KB
/
google-apps-script.spreadsheet.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
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
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
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
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
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
// Type definitions for Google Apps Script 2015-11-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.charts.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
/// <reference path="google-apps-script.drive.d.ts" />
declare namespace GoogleAppsScript {
export module Spreadsheet {
/**
* The chart's position within a sheet. Can be updated using the EmbeddedChart.modify()
* function.
*
* chart = chart.modify().setPosition(5, 5, 0, 0).build();
* sheet.updateChart(chart);
*/
export interface ContainerInfo {
getAnchorColumn(): Integer;
getAnchorRow(): Integer;
getOffsetX(): Integer;
getOffsetY(): Integer;
}
/**
* This class allows users to access existing data-validation rules. To create a new rule, see
* SpreadsheetApp.newDataValidation(), DataValidationBuilder, and
* Range.setDataValidation(rule).
*
* // Log information about the data-validation rule for cell A1.
* var cell = SpreadsheetApp.getActive().getRange('A1');
* var rule = cell.getDataValidation();
* if (rule != null) {
* var criteria = rule.getCriteriaType();
* var args = rule.getCriteriaValues();
* Logger.log('The data-validation rule is %s %s', criteria, args);
* } else {
* Logger.log('The cell does not have a data-validation rule.')
* }
*/
export interface DataValidation {
copy(): DataValidationBuilder;
getAllowInvalid(): boolean;
getCriteriaType(): DataValidationCriteria;
getCriteriaValues(): Object[];
getHelpText(): string;
}
/**
* Builder for data-validation rules.
*
* // Set the data validation for cell A1 to require a value from B1:B10.
* var cell = SpreadsheetApp.getActive().getRange('A1');
* var range = SpreadsheetApp.getActive().getRange('B1:B10');
* var rule = SpreadsheetApp.newDataValidation().requireValueInRange(range).build();
* cell.setDataValidation(rule);
*/
export interface DataValidationBuilder {
build(): DataValidation;
copy(): DataValidationBuilder;
getAllowInvalid(): boolean;
getCriteriaType(): DataValidationCriteria;
getCriteriaValues(): Object[];
getHelpText(): string;
requireDate(): DataValidationBuilder;
requireDateAfter(date: Date): DataValidationBuilder;
requireDateBefore(date: Date): DataValidationBuilder;
requireDateBetween(start: Date, end: Date): DataValidationBuilder;
requireDateEqualTo(date: Date): DataValidationBuilder;
requireDateNotBetween(start: Date, end: Date): DataValidationBuilder;
requireDateOnOrAfter(date: Date): DataValidationBuilder;
requireDateOnOrBefore(date: Date): DataValidationBuilder;
requireFormulaSatisfied(formula: string): DataValidationBuilder;
requireNumberBetween(start: Number, end: Number): DataValidationBuilder;
requireNumberEqualTo(number: Number): DataValidationBuilder;
requireNumberGreaterThan(number: Number): DataValidationBuilder;
requireNumberGreaterThanOrEqualTo(number: Number): DataValidationBuilder;
requireNumberLessThan(number: Number): DataValidationBuilder;
requireNumberLessThanOrEqualTo(number: Number): DataValidationBuilder;
requireNumberNotBetween(start: Number, end: Number): DataValidationBuilder;
requireNumberNotEqualTo(number: Number): DataValidationBuilder;
requireTextContains(text: string): DataValidationBuilder;
requireTextDoesNotContain(text: string): DataValidationBuilder;
requireTextEqualTo(text: string): DataValidationBuilder;
requireTextIsEmail(): DataValidationBuilder;
requireTextIsUrl(): DataValidationBuilder;
requireValueInList(values: String[]): DataValidationBuilder;
requireValueInList(values: String[], showDropdown: boolean): DataValidationBuilder;
requireValueInRange(range: Range): DataValidationBuilder;
requireValueInRange(range: Range, showDropdown: boolean): DataValidationBuilder;
setAllowInvalid(allowInvalidData: boolean): DataValidationBuilder;
setHelpText(helpText: string): DataValidationBuilder;
withCriteria(criteria: DataValidationCriteria, args: Object[]): DataValidationBuilder;
}
/**
* An enumeration representing the data-validation criteria that can be set on a range.
*
* // Change existing data-validation rules that require a date in 2013 to require a date in 2014.
* var oldDates = [new Date('1/1/2013'), new Date('12/31/2013')];
* var newDates = [new Date('1/1/2014'), new Date('12/31/2014')];
* var sheet = SpreadsheetApp.getActiveSheet();
* var range = sheet.getRange(1, 1, sheet.getMaxRows(), sheet.getMaxColumns());
* var rules = range.getDataValidations();
*
* for (var i = 0; i < rules.length; i++) {
* for (var j = 0; j < rules[i].length; j++) {
* var rule = rules[i][j];
*
* if (rule != null) {
* var criteria = rule.getCriteriaType();
* var args = rule.getCriteriaValues();
*
* if (criteria == SpreadsheetApp.DataValidationCriteria.DATE_BETWEEN
* && args[0].getTime() == oldDates[0].getTime()
* && args[1].getTime() == oldDates[1].getTime()) {
* // Create a builder from the existing rule, then change the dates.
* rules[i][j] = rule.copy().withCriteria(criteria, newDates).build();
* }
* }
* }
* }
* range.setDataValidations(rules);
*/
export enum DataValidationCriteria { DATE_AFTER, DATE_BEFORE, DATE_BETWEEN, DATE_EQUAL_TO, DATE_IS_VALID_DATE, DATE_NOT_BETWEEN, DATE_ON_OR_AFTER, DATE_ON_OR_BEFORE, NUMBER_BETWEEN, NUMBER_EQUAL_TO, NUMBER_GREATER_THAN, NUMBER_GREATER_THAN_OR_EQUAL_TO, NUMBER_LESS_THAN, NUMBER_LESS_THAN_OR_EQUAL_TO, NUMBER_NOT_BETWEEN, NUMBER_NOT_EQUAL_TO, TEXT_CONTAINS, TEXT_DOES_NOT_CONTAIN, TEXT_EQUAL_TO, TEXT_IS_VALID_EMAIL, TEXT_IS_VALID_URL, VALUE_IN_LIST, VALUE_IN_RANGE, CUSTOM_FORMULA }
/**
* Builder for area charts. For more details, see the Gviz
* documentation.
*/
export interface EmbeddedAreaChartBuilder {
addRange(range: Range): EmbeddedChartBuilder;
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
asTableChart(): EmbeddedTableChartBuilder;
build(): EmbeddedChart;
getChartType(): Charts.ChartType;
getContainer(): ContainerInfo;
getRanges(): Range[];
removeRange(range: Range): EmbeddedChartBuilder;
reverseCategories(): EmbeddedAreaChartBuilder;
setBackgroundColor(cssValue: string): EmbeddedAreaChartBuilder;
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
setColors(cssValues: String[]): EmbeddedAreaChartBuilder;
setLegendPosition(position: Charts.Position): EmbeddedAreaChartBuilder;
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedAreaChartBuilder;
setOption(option: string, value: Object): EmbeddedChartBuilder;
setPointStyle(style: Charts.PointStyle): EmbeddedAreaChartBuilder;
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
setRange(start: Number, end: Number): EmbeddedAreaChartBuilder;
setStacked(): EmbeddedAreaChartBuilder;
setTitle(chartTitle: string): EmbeddedAreaChartBuilder;
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedAreaChartBuilder;
setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedAreaChartBuilder;
setXAxisTitle(title: string): EmbeddedAreaChartBuilder;
setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedAreaChartBuilder;
setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedAreaChartBuilder;
setYAxisTitle(title: string): EmbeddedAreaChartBuilder;
setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedAreaChartBuilder;
useLogScale(): EmbeddedAreaChartBuilder;
}
/**
* Builder for bar charts. For more details, see the Gviz
* documentation.
*/
export interface EmbeddedBarChartBuilder {
addRange(range: Range): EmbeddedChartBuilder;
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
asTableChart(): EmbeddedTableChartBuilder;
build(): EmbeddedChart;
getChartType(): Charts.ChartType;
getContainer(): ContainerInfo;
getRanges(): Range[];
removeRange(range: Range): EmbeddedChartBuilder;
reverseCategories(): EmbeddedBarChartBuilder;
reverseDirection(): EmbeddedBarChartBuilder;
setBackgroundColor(cssValue: string): EmbeddedBarChartBuilder;
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
setColors(cssValues: String[]): EmbeddedBarChartBuilder;
setLegendPosition(position: Charts.Position): EmbeddedBarChartBuilder;
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedBarChartBuilder;
setOption(option: string, value: Object): EmbeddedChartBuilder;
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
setRange(start: Number, end: Number): EmbeddedBarChartBuilder;
setStacked(): EmbeddedBarChartBuilder;
setTitle(chartTitle: string): EmbeddedBarChartBuilder;
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedBarChartBuilder;
setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedBarChartBuilder;
setXAxisTitle(title: string): EmbeddedBarChartBuilder;
setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedBarChartBuilder;
setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedBarChartBuilder;
setYAxisTitle(title: string): EmbeddedBarChartBuilder;
setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedBarChartBuilder;
useLogScale(): EmbeddedBarChartBuilder;
}
/**
* Represents a chart that has been embedded into a Spreadsheet.
*
* This example shows how to modify an existing chart:
*
* var sheet = SpreadsheetApp.getActiveSheet();
* var range = sheet.getRange("A2:B8")
* var chart = sheet.getCharts()[0];
* chart = chart.modify()
* .addRange(range)
* .setOption('title', 'Updated!')
* .setOption('animation.duration', 500)
* .setPosition(2,2,0,0)
* .build();
* sheet.updateChart(chart);
*
* This example shows how to create a new chart:
*
* function newChart(range, sheet) {
* var sheet = SpreadsheetApp.getActiveSheet();
* var chartBuilder = sheet.newChart();
* chartBuilder.addRange(range)
* .setChartType(Charts.ChartType.LINE)
* .setOption('title', 'My Line Chart!');
* sheet.insertChart(chartBuilder.build());
* }
*/
export interface EmbeddedChart {
getAs(contentType: string): Base.Blob;
getBlob(): Base.Blob;
getContainerInfo(): ContainerInfo;
getId(): string;
getOptions(): Charts.ChartOptions;
getRanges(): Range[];
getType(): string;
modify(): EmbeddedChartBuilder;
setId(id: string): Charts.Chart;
}
/**
* This builder allows you to edit an EmbeddedChart. Make sure to call
* sheet.updateChart(builder.build()) to save your changes.
*
* var sheet = SpreadsheetApp.getActiveSheet();
* var range = sheet.getRange("A1:B8");
* var chart = sheet.getCharts()[0];
* chart = chart.modify()
* .addRange(range)
* .setOption('title', 'Updated!')
* .setOption('animation.duration', 500)
* .setPosition(2,2,0,0)
* .build();
* sheet.updateChart(chart);
*/
export interface EmbeddedChartBuilder {
addRange(range: Range): EmbeddedChartBuilder;
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
asTableChart(): EmbeddedTableChartBuilder;
build(): EmbeddedChart;
getChartType(): Charts.ChartType;
getContainer(): ContainerInfo;
getRanges(): Range[];
removeRange(range: Range): EmbeddedChartBuilder;
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
setOption(option: string, value: Object): EmbeddedChartBuilder;
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
}
/**
* Builder for column charts. For more details, see the Gviz
* documentation.
*/
export interface EmbeddedColumnChartBuilder {
addRange(range: Range): EmbeddedChartBuilder;
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
asTableChart(): EmbeddedTableChartBuilder;
build(): EmbeddedChart;
getChartType(): Charts.ChartType;
getContainer(): ContainerInfo;
getRanges(): Range[];
removeRange(range: Range): EmbeddedChartBuilder;
reverseCategories(): EmbeddedColumnChartBuilder;
setBackgroundColor(cssValue: string): EmbeddedColumnChartBuilder;
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
setColors(cssValues: String[]): EmbeddedColumnChartBuilder;
setLegendPosition(position: Charts.Position): EmbeddedColumnChartBuilder;
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedColumnChartBuilder;
setOption(option: string, value: Object): EmbeddedChartBuilder;
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
setRange(start: Number, end: Number): EmbeddedColumnChartBuilder;
setStacked(): EmbeddedColumnChartBuilder;
setTitle(chartTitle: string): EmbeddedColumnChartBuilder;
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedColumnChartBuilder;
setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedColumnChartBuilder;
setXAxisTitle(title: string): EmbeddedColumnChartBuilder;
setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedColumnChartBuilder;
setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedColumnChartBuilder;
setYAxisTitle(title: string): EmbeddedColumnChartBuilder;
setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedColumnChartBuilder;
useLogScale(): EmbeddedColumnChartBuilder;
}
/**
* Builder for line charts. For more details, see the Gviz
* documentation.
*/
export interface EmbeddedLineChartBuilder {
addRange(range: Range): EmbeddedChartBuilder;
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
asTableChart(): EmbeddedTableChartBuilder;
build(): EmbeddedChart;
getChartType(): Charts.ChartType;
getContainer(): ContainerInfo;
getRanges(): Range[];
removeRange(range: Range): EmbeddedChartBuilder;
reverseCategories(): EmbeddedLineChartBuilder;
setBackgroundColor(cssValue: string): EmbeddedLineChartBuilder;
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
setColors(cssValues: String[]): EmbeddedLineChartBuilder;
setCurveStyle(style: Charts.CurveStyle): EmbeddedLineChartBuilder;
setLegendPosition(position: Charts.Position): EmbeddedLineChartBuilder;
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedLineChartBuilder;
setOption(option: string, value: Object): EmbeddedChartBuilder;
setPointStyle(style: Charts.PointStyle): EmbeddedLineChartBuilder;
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
setRange(start: Number, end: Number): EmbeddedLineChartBuilder;
setTitle(chartTitle: string): EmbeddedLineChartBuilder;
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedLineChartBuilder;
setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedLineChartBuilder;
setXAxisTitle(title: string): EmbeddedLineChartBuilder;
setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedLineChartBuilder;
setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedLineChartBuilder;
setYAxisTitle(title: string): EmbeddedLineChartBuilder;
setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedLineChartBuilder;
useLogScale(): EmbeddedLineChartBuilder;
}
/**
* Builder for pie charts. For more details, see the Gviz
* documentation.
*/
export interface EmbeddedPieChartBuilder {
addRange(range: Range): EmbeddedChartBuilder;
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
asTableChart(): EmbeddedTableChartBuilder;
build(): EmbeddedChart;
getChartType(): Charts.ChartType;
getContainer(): ContainerInfo;
getRanges(): Range[];
removeRange(range: Range): EmbeddedChartBuilder;
reverseCategories(): EmbeddedPieChartBuilder;
set3D(): EmbeddedPieChartBuilder;
setBackgroundColor(cssValue: string): EmbeddedPieChartBuilder;
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
setColors(cssValues: String[]): EmbeddedPieChartBuilder;
setLegendPosition(position: Charts.Position): EmbeddedPieChartBuilder;
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedPieChartBuilder;
setOption(option: string, value: Object): EmbeddedChartBuilder;
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
setTitle(chartTitle: string): EmbeddedPieChartBuilder;
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedPieChartBuilder;
}
/**
* Builder for scatter charts. For more details, see the Gviz
* documentation.
*/
export interface EmbeddedScatterChartBuilder {
addRange(range: Range): EmbeddedChartBuilder;
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
asTableChart(): EmbeddedTableChartBuilder;
build(): EmbeddedChart;
getChartType(): Charts.ChartType;
getContainer(): ContainerInfo;
getRanges(): Range[];
removeRange(range: Range): EmbeddedChartBuilder;
setBackgroundColor(cssValue: string): EmbeddedScatterChartBuilder;
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
setColors(cssValues: String[]): EmbeddedScatterChartBuilder;
setLegendPosition(position: Charts.Position): EmbeddedScatterChartBuilder;
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedScatterChartBuilder;
setOption(option: string, value: Object): EmbeddedChartBuilder;
setPointStyle(style: Charts.PointStyle): EmbeddedScatterChartBuilder;
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
setTitle(chartTitle: string): EmbeddedScatterChartBuilder;
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedScatterChartBuilder;
setXAxisLogScale(): EmbeddedScatterChartBuilder;
setXAxisRange(start: Number, end: Number): EmbeddedScatterChartBuilder;
setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedScatterChartBuilder;
setXAxisTitle(title: string): EmbeddedScatterChartBuilder;
setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedScatterChartBuilder;
setYAxisLogScale(): EmbeddedScatterChartBuilder;
setYAxisRange(start: Number, end: Number): EmbeddedScatterChartBuilder;
setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedScatterChartBuilder;
setYAxisTitle(title: string): EmbeddedScatterChartBuilder;
setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedScatterChartBuilder;
}
/**
* Builder for table charts. For more details, see the Gviz
* documentation.
*/
export interface EmbeddedTableChartBuilder {
addRange(range: Range): EmbeddedChartBuilder;
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
asTableChart(): EmbeddedTableChartBuilder;
build(): EmbeddedChart;
enablePaging(enablePaging: boolean): EmbeddedTableChartBuilder;
enablePaging(pageSize: Integer): EmbeddedTableChartBuilder;
enablePaging(pageSize: Integer, startPage: Integer): EmbeddedTableChartBuilder;
enableRtlTable(rtlEnabled: boolean): EmbeddedTableChartBuilder;
enableSorting(enableSorting: boolean): EmbeddedTableChartBuilder;
getChartType(): Charts.ChartType;
getContainer(): ContainerInfo;
getRanges(): Range[];
removeRange(range: Range): EmbeddedChartBuilder;
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
setFirstRowNumber(number: Integer): EmbeddedTableChartBuilder;
setInitialSortingAscending(column: Integer): EmbeddedTableChartBuilder;
setInitialSortingDescending(column: Integer): EmbeddedTableChartBuilder;
setOption(option: string, value: Object): EmbeddedChartBuilder;
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
showRowNumberColumn(showRowNumber: boolean): EmbeddedTableChartBuilder;
useAlternatingRowStyle(alternate: boolean): EmbeddedTableChartBuilder;
}
/**
*
* Deprecated. For spreadsheets created in the newer version of Google Sheets, use the more powerful
* Protection class instead. Although this class is deprecated, it will remain
* available for compatibility with the older version of Sheets.
* Access and modify protected sheets in the older version of Google Sheets.
*/
export interface PageProtection {
addUser(email: string): void;
getUsers(): String[];
isProtected(): boolean;
removeUser(user: string): void;
setProtected(protection: boolean): void;
}
/**
* Access and modify protected ranges and sheets. A protected range can protect either a static
* range of cells or a named range. A protected sheet may include unprotected regions. For
* spreadsheets created with the older version of Google Sheets, use the PageProtection
* class instead.
*
* // Protect range A1:B10, then remove all other users from the list of editors.
* var ss = SpreadsheetApp.getActive();
* var range = ss.getRange('A1:B10');
* var protection = range.protect().setDescription('Sample protected range');
*
* // Ensure the current user is an editor before removing others. Otherwise, if the user's edit
* // permission comes from a group, the script will throw an exception upon removing the group.
* var me = Session.getEffectiveUser();
* protection.addEditor(me);
* protection.removeEditors(protection.getEditors());
* if (protection.canDomainEdit()) {
* protection.setDomainEdit(false);
* }
*
* // Remove all range protections in the spreadsheet that the user has permission to edit.
* var ss = SpreadsheetApp.getActive();
* var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);
* for (var i = 0; i < protections.length; i++) {
* var protection = protections[i];
* if (protection.canEdit()) {
* protection.remove();
* }
* }
*
* // Protect the active sheet, then remove all other users from the list of editors.
* var sheet = SpreadsheetApp.getActiveSheet();
* var protection = sheet.protect().setDescription('Sample protected sheet');
*
* // Ensure the current user is an editor before removing others. Otherwise, if the user's edit
* // permission comes from a group, the script will throw an exception upon removing the group.
* var me = Session.getEffectiveUser();
* protection.addEditor(me);
* protection.removeEditors(protection.getEditors());
* if (protection.canDomainEdit()) {
* protection.setDomainEdit(false);
* }
*/
export interface Protection {
addEditor(emailAddress: string): Protection;
addEditor(user: Base.User): Protection;
addEditors(emailAddresses: String[]): Protection;
canDomainEdit(): boolean;
canEdit(): boolean;
getDescription(): string;
getEditors(): Base.User[];
getProtectionType(): ProtectionType;
getRange(): Range;
getRangeName(): string;
getUnprotectedRanges(): Range[];
isWarningOnly(): boolean;
remove(): void;
removeEditor(emailAddress: string): Protection;
removeEditor(user: Base.User): Protection;
removeEditors(emailAddresses: String[]): Protection;
setDescription(description: string): Protection;
setDomainEdit(editable: boolean): Protection;
setRange(range: Range): Protection;
setRangeName(rangeName: string): Protection;
setUnprotectedRanges(ranges: Range[]): Protection;
setWarningOnly(warningOnly: boolean): Protection;
}
/**
* An enumeration representing the parts of a spreadsheet that can be protected from edits.
*
* // Remove all range protections in the spreadsheet that the user has permission to edit.
* var ss = SpreadsheetApp.getActive();
* var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);
* for (var i = 0; i < protections.length; i++) {
* var protection = protections[i];
* if (protection.canEdit()) {
* protection.remove();
* }
* }
*
* // Removes sheet protection from the active sheet, if the user has permission to edit it.
* var sheet = SpreadsheetApp.getActiveSheet();
* var protection = sheet.getProtections(SpreadsheetApp.ProtectionType.SHEET)[0];
* if (protection && protection.canEdit()) {
* protection.remove();
* }
*/
export enum ProtectionType { RANGE, SHEET }
/**
* Access and modify spreadsheet ranges.
*
* This class allows users to access and modify ranges in Google Sheets. A range can be
* a single cell in a sheet or a range of cells in a sheet.
*/
export interface Range {
activate(): Range;
breakApart(): Range;
canEdit(): boolean;
clear(): Range;
clear(options: Object): Range;
clearContent(): Range;
clearDataValidations(): Range;
clearFormat(): Range;
clearNote(): Range;
copyFormatToRange(gridId: Integer, column: Integer, columnEnd: Integer, row: Integer, rowEnd: Integer): void;
copyFormatToRange(sheet: Sheet, column: Integer, columnEnd: Integer, row: Integer, rowEnd: Integer): void;
copyTo(destination: Range): void;
copyTo(destination: Range, options: Object): void;
copyValuesToRange(gridId: Integer, column: Integer, columnEnd: Integer, row: Integer, rowEnd: Integer): void;
copyValuesToRange(sheet: Sheet, column: Integer, columnEnd: Integer, row: Integer, rowEnd: Integer): void;
getA1Notation(): string;
getBackground(): string;
getBackgrounds(): String[][];
getCell(row: Integer, column: Integer): Range;
getColumn(): Integer;
getDataSourceUrl(): string;
getDataTable(): Charts.DataTable;
getDataTable(firstRowIsHeader: boolean): Charts.DataTable;
getDataValidation(): DataValidation;
getDataValidations(): DataValidation[][];
getFontColor(): string;
getFontColors(): String[][];
getFontFamilies(): String[][];
getFontFamily(): string;
getFontLine(): string;
getFontLines(): String[][];
getFontSize(): Integer;
getFontSizes(): Integer[][];
getFontStyle(): string;
getFontStyles(): String[][];
getFontWeight(): string;
getFontWeights(): String[][];
getFormula(): string;
getFormulaR1C1(): string;
getFormulas(): String[][];
getFormulasR1C1(): String[][];
getGridId(): Integer;
getHeight(): Integer;
getHorizontalAlignment(): string;
getHorizontalAlignments(): String[][];
getLastColumn(): Integer;
getLastRow(): Integer;
getNote(): string;
getNotes(): String[][];
getNumColumns(): Integer;
getNumRows(): Integer;
getNumberFormat(): string;
getNumberFormats(): String[][];
getRow(): Integer;
getRowIndex(): Integer;
getSheet(): Sheet;
getValue(): Object;
getValues(): Object[][];
getVerticalAlignment(): string;
getVerticalAlignments(): String[][];
getWidth(): Integer;
getWrap(): boolean;
getWraps(): Boolean[][];
isBlank(): boolean;
isEndColumnBounded(): boolean;
isEndRowBounded(): boolean;
isStartColumnBounded(): boolean;
isStartRowBounded(): boolean;
merge(): Range;
mergeAcross(): Range;
mergeVertically(): Range;
moveTo(target: Range): void;
offset(rowOffset: Integer, columnOffset: Integer): Range;
offset(rowOffset: Integer, columnOffset: Integer, numRows: Integer): Range;
offset(rowOffset: Integer, columnOffset: Integer, numRows: Integer, numColumns: Integer): Range;
protect(): Protection;
setBackground(color: string): Range;
setBackgroundRGB(red: Integer, green: Integer, blue: Integer): Range;
setBackgrounds(color: String[][]): Range;
setBorder(top: boolean, left: boolean, bottom: boolean, right: boolean, vertical: boolean, horizontal: boolean): Range;
setDataValidation(rule: DataValidation): Range;
setDataValidations(rules: DataValidation[][]): Range;
setFontColor(color: string): Range;
setFontColors(colors: Object[][]): Range;
setFontFamilies(fontFamilies: Object[][]): Range;
setFontFamily(fontFamily: string): Range;
setFontLine(fontLine: string): Range;
setFontLines(fontLines: Object[][]): Range;
setFontSize(size: Integer): Range;
setFontSizes(sizes: Object[][]): Range;
setFontStyle(fontStyle: string): Range;
setFontStyles(fontStyles: Object[][]): Range;
setFontWeight(fontWeight: string): Range;
setFontWeights(fontWeights: Object[][]): Range;
setFormula(formula: string): Range;
setFormulaR1C1(formula: string): Range;
setFormulas(formulas: String[][]): Range;
setFormulasR1C1(formulas: String[][]): Range;
setHorizontalAlignment(alignment: string): Range;
setHorizontalAlignments(alignments: Object[][]): Range;
setNote(note: string): Range;
setNotes(notes: Object[][]): Range;
setNumberFormat(numberFormat: string): Range;
setNumberFormats(numberFormats: Object[][]): Range;
setValue(value: Object): Range;
setValues(values: Object[][]): Range;
setVerticalAlignment(alignment: string): Range;
setVerticalAlignments(alignments: Object[][]): Range;
setWrap(isWrapEnabled: boolean): Range;
setWraps(isWrapEnabled: Object[][]): Range;
sort(sortSpecObj: Object): Range;
}
/**
* Access and modify spreadsheet sheets. Common operations
* are renaming a sheet and accessing range objects from the sheet.
*/
export interface Sheet {
activate(): Sheet;
appendRow(rowContents: Object[]): Sheet;
autoResizeColumn(columnPosition: Integer): Sheet;
clear(): Sheet;
clear(options: Object): Sheet;
clearContents(): Sheet;
clearFormats(): Sheet;
clearNotes(): Sheet;
copyTo(spreadsheet: Spreadsheet): Sheet;
deleteColumn(columnPosition: Integer): Sheet;
deleteColumns(columnPosition: Integer, howMany: Integer): void;
deleteRow(rowPosition: Integer): Sheet;
deleteRows(rowPosition: Integer, howMany: Integer): void;
getActiveCell(): Range;
getActiveRange(): Range;
getCharts(): EmbeddedChart[];
getColumnWidth(columnPosition: Integer): Integer;
getDataRange(): Range;
getFrozenColumns(): Integer;
getFrozenRows(): Integer;
getIndex(): Integer;
getLastColumn(): Integer;
getLastRow(): Integer;
getMaxColumns(): Integer;
getMaxRows(): Integer;
getName(): string;
getParent(): Spreadsheet;
getProtections(type: ProtectionType): Protection[];
getRange(row: Integer, column: Integer): Range;
getRange(row: Integer, column: Integer, numRows: Integer): Range;
getRange(row: Integer, column: Integer, numRows: Integer, numColumns: Integer): Range;
getRange(a1Notation: string): Range;
getRowHeight(rowPosition: Integer): Integer;
getSheetId(): Integer;
getSheetName(): string;
getSheetValues(startRow: Integer, startColumn: Integer, numRows: Integer, numColumns: Integer): Object[][];
hideColumn(column: Range): void;
hideColumns(columnIndex: Integer): void;
hideColumns(columnIndex: Integer, numColumns: Integer): void;
hideRow(row: Range): void;
hideRows(rowIndex: Integer): void;
hideRows(rowIndex: Integer, numRows: Integer): void;
hideSheet(): Sheet;
insertChart(chart: EmbeddedChart): void;
insertColumnAfter(afterPosition: Integer): Sheet;
insertColumnBefore(beforePosition: Integer): Sheet;
insertColumns(columnIndex: Integer): void;
insertColumns(columnIndex: Integer, numColumns: Integer): void;
insertColumnsAfter(afterPosition: Integer, howMany: Integer): Sheet;
insertColumnsBefore(beforePosition: Integer, howMany: Integer): Sheet;
insertImage(blob: Base.Blob, column: Integer, row: Integer): void;
insertImage(blob: Base.Blob, column: Integer, row: Integer, offsetX: Integer, offsetY: Integer): void;
insertImage(url: string, column: Integer, row: Integer): void;
insertImage(url: string, column: Integer, row: Integer, offsetX: Integer, offsetY: Integer): void;
insertRowAfter(afterPosition: Integer): Sheet;
insertRowBefore(beforePosition: Integer): Sheet;
insertRows(rowIndex: Integer): void;
insertRows(rowIndex: Integer, numRows: Integer): void;
insertRowsAfter(afterPosition: Integer, howMany: Integer): Sheet;
insertRowsBefore(beforePosition: Integer, howMany: Integer): Sheet;
isSheetHidden(): boolean;
newChart(): EmbeddedChartBuilder;
protect(): Protection;
removeChart(chart: EmbeddedChart): void;
setActiveRange(range: Range): Range;
setActiveSelection(range: Range): Range;
setActiveSelection(a1Notation: string): Range;
setColumnWidth(columnPosition: Integer, width: Integer): Sheet;
setFrozenColumns(columns: Integer): void;
setFrozenRows(rows: Integer): void;
setName(name: string): Sheet;
setRowHeight(rowPosition: Integer, height: Integer): Sheet;
showColumns(columnIndex: Integer): void;
showColumns(columnIndex: Integer, numColumns: Integer): void;
showRows(rowIndex: Integer): void;
showRows(rowIndex: Integer, numRows: Integer): void;
showSheet(): Sheet;
sort(columnPosition: Integer): Sheet;
sort(columnPosition: Integer, ascending: boolean): Sheet;
unhideColumn(column: Range): void;
unhideRow(row: Range): void;
updateChart(chart: EmbeddedChart): void;
getSheetProtection(): PageProtection;
setSheetProtection(permissions: PageProtection): void;
}
/**
* This class allows users to access and modify Google Sheets files. Common operations are adding
* new sheets and adding collaborators.
*/
export interface Spreadsheet {
addEditor(emailAddress: string): Spreadsheet;
addEditor(user: Base.User): Spreadsheet;
addEditors(emailAddresses: String[]): Spreadsheet;
addMenu(name: string, subMenus: Object[]): void;
addViewer(emailAddress: string): Spreadsheet;
addViewer(user: Base.User): Spreadsheet;
addViewers(emailAddresses: String[]): Spreadsheet;
appendRow(rowContents: Object[]): Sheet;
autoResizeColumn(columnPosition: Integer): Sheet;
copy(name: string): Spreadsheet;
deleteActiveSheet(): Sheet;
deleteColumn(columnPosition: Integer): Sheet;
deleteColumns(columnPosition: Integer, howMany: Integer): void;
deleteRow(rowPosition: Integer): Sheet;
deleteRows(rowPosition: Integer, howMany: Integer): void;
deleteSheet(sheet: Sheet): void;
duplicateActiveSheet(): Sheet;
getActiveCell(): Range;
getActiveRange(): Range;
getActiveSheet(): Sheet;
getAs(contentType: string): Base.Blob;
getBlob(): Base.Blob;
getColumnWidth(columnPosition: Integer): Integer;
getDataRange(): Range;
getEditors(): Base.User[];
getFormUrl(): string;
getFrozenColumns(): Integer;
getFrozenRows(): Integer;
getId(): string;
getLastColumn(): Integer;
getLastRow(): Integer;
getName(): string;
getNumSheets(): Integer;
getOwner(): Base.User;
getProtections(type: ProtectionType): Protection[];
getRange(a1Notation: string): Range;
getRangeByName(name: string): Range;
getRowHeight(rowPosition: Integer): Integer;
getSheetByName(name: string): Sheet;
getSheetId(): Integer;
getSheetName(): string;
getSheetValues(startRow: Integer, startColumn: Integer, numRows: Integer, numColumns: Integer): Object[][];
getSheets(): Sheet[];
getSpreadsheetLocale(): string;
getSpreadsheetTimeZone(): string;
getUrl(): string;
getViewers(): Base.User[];
hideColumn(column: Range): void;
hideRow(row: Range): void;
insertColumnAfter(afterPosition: Integer): Sheet;
insertColumnBefore(beforePosition: Integer): Sheet;
insertColumnsAfter(afterPosition: Integer, howMany: Integer): Sheet;
insertColumnsBefore(beforePosition: Integer, howMany: Integer): Sheet;
insertImage(blob: Base.Blob, column: Integer, row: Integer): void;
insertImage(blob: Base.Blob, column: Integer, row: Integer, offsetX: Integer, offsetY: Integer): void;
insertImage(url: string, column: Integer, row: Integer): void;
insertImage(url: string, column: Integer, row: Integer, offsetX: Integer, offsetY: Integer): void;
insertRowAfter(afterPosition: Integer): Sheet;
insertRowBefore(beforePosition: Integer): Sheet;
insertRowsAfter(afterPosition: Integer, howMany: Integer): Sheet;
insertRowsBefore(beforePosition: Integer, howMany: Integer): Sheet;
insertSheet(): Sheet;
insertSheet(sheetIndex: Integer): Sheet;
insertSheet(sheetIndex: Integer, options: Object): Sheet;
insertSheet(options: Object): Sheet;
insertSheet(sheetName: string): Sheet;
insertSheet(sheetName: string, sheetIndex: Integer): Sheet;
insertSheet(sheetName: string, sheetIndex: Integer, options: Object): Sheet;
insertSheet(sheetName: string, options: Object): Sheet;
moveActiveSheet(pos: Integer): void;
removeEditor(emailAddress: string): Spreadsheet;
removeEditor(user: Base.User): Spreadsheet;
removeMenu(name: string): void;
removeNamedRange(name: string): void;
removeViewer(emailAddress: string): Spreadsheet;
removeViewer(user: Base.User): Spreadsheet;
rename(newName: string): void;
renameActiveSheet(newName: string): void;
setActiveRange(range: Range): Range;
setActiveSelection(range: Range): Range;
setActiveSelection(a1Notation: string): Range;
setActiveSheet(sheet: Sheet): Sheet;
setColumnWidth(columnPosition: Integer, width: Integer): Sheet;
setFrozenColumns(columns: Integer): void;
setFrozenRows(rows: Integer): void;
setNamedRange(name: string, range: Range): void;
setRowHeight(rowPosition: Integer, height: Integer): Sheet;
setSpreadsheetLocale(locale: string): void;
setSpreadsheetTimeZone(timezone: string): void;
show(userInterface: Object): void;
sort(columnPosition: Integer): Sheet;
sort(columnPosition: Integer, ascending: boolean): Sheet;
toast(msg: string): void;
toast(msg: string, title: string): void;
toast(msg: string, title: string, timeoutSeconds: Number): void;
unhideColumn(column: Range): void;
unhideRow(row: Range): void;
updateMenu(name: string, subMenus: Object[]): void;
getSheetProtection(): PageProtection;
isAnonymousView(): boolean;
isAnonymousWrite(): boolean;
setAnonymousAccess(anonymousReadAllowed: boolean, anonymousWriteAllowed: boolean): void;
setSheetProtection(permissions: PageProtection): void;
}
/**
* This class allows users to open Google Sheets files and to create new ones. This class is
* the parent class for the Spreadsheet service.
*/
export interface SpreadsheetApp {
DataValidationCriteria: DataValidationCriteria
ProtectionType: ProtectionType
create(name: string): Spreadsheet;
create(name: string, rows: Integer, columns: Integer): Spreadsheet;
flush(): void;
getActive(): Spreadsheet;
getActiveRange(): Range;
getActiveSheet(): Sheet;
getActiveSpreadsheet(): Spreadsheet;
getUi(): Base.Ui;
newDataValidation(): DataValidationBuilder;
open(file: Drive.File): Spreadsheet;
openById(id: string): Spreadsheet;
openByUrl(url: string): Spreadsheet;
setActiveRange(range: Range): Range;
setActiveSheet(sheet: Sheet): Sheet;
setActiveSpreadsheet(newActiveSpreadsheet: Spreadsheet): void;
}
}
}
declare var SpreadsheetApp: GoogleAppsScript.Spreadsheet.SpreadsheetApp;