google-spreadsheet 5.0.3 → 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.
@@ -196,19 +196,19 @@ export type DimensionRangeIndexes = {
196
196
 
197
197
  /** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#DeveloperMetadata.DeveloperMetadataLocation */
198
198
  export interface DeveloperMetadataLocation {
199
- sheetId: number;
200
- spreadsheet: boolean;
201
- dimensionRange: DimensionRange;
202
- locationType: DeveloperMetadataLocationType;
199
+ sheetId?: number;
200
+ spreadsheet?: boolean;
201
+ dimensionRange?: DimensionRange;
202
+ locationType?: DeveloperMetadataLocationType;
203
203
  }
204
204
 
205
205
  /** @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.developerMetadata#DeveloperMetadata.DeveloperMetadataLocation */
206
206
  export interface DeveloperMetadata {
207
- metadataId: number;
207
+ metadataId?: number;
208
208
  metadataKey: string;
209
- metadataValue: string;
210
- location: DeveloperMetadataLocation;
211
- visibility: DeveloperMetadataVisibility;
209
+ metadataValue?: string;
210
+ location?: DeveloperMetadataLocation;
211
+ visibility?: DeveloperMetadataVisibility;
212
212
  }
213
213
 
214
214
  export interface WorksheetDimensionProperties {
@@ -413,6 +413,86 @@ export type GridRangeWithOptionalWorksheetId = MakeOptional<GridRange, 'sheetId'
413
413
  export type DataFilter = A1Range | GridRange;
414
414
  export type DataFilterWithoutWorksheetId = A1Range | GridRangeWithoutWorksheetId;
415
415
 
416
+ /**
417
+ * A coordinate in a sheet. All indexes are zero-based.
418
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#GridCoordinate
419
+ */
420
+ export type GridCoordinate = {
421
+ /** The sheet this coordinate is on */
422
+ sheetId: WorksheetId,
423
+ /** The row index of the coordinate */
424
+ rowIndex: RowIndex,
425
+ /** The column index of the coordinate */
426
+ columnIndex: ColumnIndex
427
+ };
428
+ export type GridCoordinateWithOptionalWorksheetId = MakeOptional<GridCoordinate, 'sheetId'>;
429
+
430
+ /**
431
+ * How a paste operation should be applied.
432
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#PasteType
433
+ */
434
+ export type PasteType =
435
+ | 'PASTE_NORMAL'
436
+ | 'PASTE_VALUES'
437
+ | 'PASTE_FORMAT'
438
+ | 'PASTE_NO_BORDERS'
439
+ | 'PASTE_FORMULA'
440
+ | 'PASTE_DATA_VALIDATION'
441
+ | 'PASTE_CONDITIONAL_FORMATTING';
442
+
443
+ /**
444
+ * How pasted data should be oriented.
445
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#PasteOrientation
446
+ */
447
+ export type PasteOrientation = 'NORMAL' | 'TRANSPOSE';
448
+
449
+ /**
450
+ * The delimiter type for text to columns operations.
451
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DelimiterType
452
+ */
453
+ export type DelimiterType =
454
+ | 'DELIMITER_TYPE_UNSPECIFIED'
455
+ | 'COMMA'
456
+ | 'SEMICOLON'
457
+ | 'PERIOD'
458
+ | 'SPACE'
459
+ | 'CUSTOM'
460
+ | 'AUTODETECT';
461
+
462
+ /**
463
+ * The order data should be sorted.
464
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#sortorder
465
+ */
466
+ export type SortOrder = 'SORT_ORDER_UNSPECIFIED' | 'ASCENDING' | 'DESCENDING';
467
+
468
+ /**
469
+ * A sort order specification for a single column.
470
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/other#sortspec
471
+ */
472
+ export type SortSpec = {
473
+ /** The dimension (column index) to sort by */
474
+ dimensionIndex: Integer,
475
+ /** The order data should be sorted */
476
+ sortOrder?: SortOrder,
477
+ /** Background color to sort by - cells with this color are sorted to the top */
478
+ backgroundColorStyle?: any,
479
+ /** Foreground color to sort by - cells with this color are sorted to the top */
480
+ foregroundColorStyle?: any
481
+ };
482
+
483
+ /**
484
+ * Source and destination areas for autofill operations.
485
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#SourceAndDestination
486
+ */
487
+ export type SourceAndDestination = {
488
+ /** The source range to autofill from (sheetId optional) */
489
+ source: GridRangeWithOptionalWorksheetId,
490
+ /** The dimension that data should be filled in */
491
+ dimension: WorksheetDimension,
492
+ /** The number of rows or columns to fill (positive = after, negative = before) */
493
+ fillLength: Integer
494
+ };
495
+
416
496
  /**
417
497
  * object describing the editors of a protected range
418
498
  * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#Editors
@@ -646,3 +726,170 @@ export type DataValidationRule = {
646
726
  /** True if the UI should be customized based on the kind of condition. If true, "List" conditions will show a dropdown. */
647
727
  showCustomUi: boolean;
648
728
  };
729
+
730
+ /**
731
+ * Filtering specification for a column
732
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#FilterSpec
733
+ */
734
+ export type FilterSpec = {
735
+ /** The column index */
736
+ columnIndex?: Integer;
737
+ /** The filter criteria */
738
+ filterCriteria?: BooleanCondition;
739
+ /** The reference to the data source column (for data source sheets) */
740
+ dataSourceColumnReference?: any;
741
+ };
742
+
743
+ /**
744
+ * A filter view in a sheet
745
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#FilterView
746
+ */
747
+ export type FilterView = {
748
+ /** The ID of the filter view */
749
+ filterViewId?: Integer;
750
+ /** The name of the filter view */
751
+ title?: string;
752
+ /** The range this filter view covers */
753
+ range?: GridRange;
754
+ /** The named range this filter view is backed by (mutually exclusive with range) */
755
+ namedRangeId?: string;
756
+ /** The table this filter view is backed by (mutually exclusive with range) */
757
+ tableId?: string;
758
+ /** The sort order per column */
759
+ sortSpecs?: SortSpec[];
760
+ /** The criteria for showing/hiding values per column (deprecated, use filterSpecs) */
761
+ criteria?: Record<string, BooleanCondition>;
762
+ /** The filter specifications per column */
763
+ filterSpecs?: FilterSpec[];
764
+ };
765
+
766
+ /**
767
+ * A rule describing a conditional format
768
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#ConditionalFormatRule
769
+ */
770
+ export type ConditionalFormatRule = {
771
+ /** The ranges that are formatted if the condition is true */
772
+ ranges?: GridRange[];
773
+ /** The formatting is either 'on' or 'off' according to the rule */
774
+ booleanRule?: BooleanRule;
775
+ /** The formatting will vary based on the gradients in the rule */
776
+ gradientRule?: GradientRule;
777
+ };
778
+
779
+ /**
780
+ * A rule that may or may not match, depending on the condition
781
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#BooleanRule
782
+ */
783
+ export type BooleanRule = {
784
+ /** The condition of the rule */
785
+ condition: BooleanCondition;
786
+ /** The format to apply (partial format supported) */
787
+ format: Partial<CellFormat>;
788
+ };
789
+
790
+ /**
791
+ * A rule that applies a gradient color scale format
792
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#GradientRule
793
+ */
794
+ export type GradientRule = {
795
+ /** The starting point for the gradient */
796
+ minpoint: InterpolationPoint;
797
+ /** The midway point for the gradient (optional) */
798
+ midpoint?: InterpolationPoint;
799
+ /** The final point for the gradient */
800
+ maxpoint: InterpolationPoint;
801
+ };
802
+
803
+ /**
804
+ * A single interpolation point on a gradient
805
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#InterpolationPoint
806
+ */
807
+ export type InterpolationPoint = {
808
+ /** The color to use at this point */
809
+ color?: Color;
810
+ /** The color style to use at this point */
811
+ colorStyle?: ColorStyle;
812
+ /** How to calculate the value that this interpolation point uses */
813
+ type?: InterpolationPointType;
814
+ /** The value this interpolation point uses */
815
+ value?: string;
816
+ };
817
+
818
+ /**
819
+ * The type of interpolation point
820
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#interpolationpointtype
821
+ */
822
+ export type InterpolationPointType = 'MIN' | 'MAX' | 'NUMBER' | 'PERCENT' | 'PERCENTILE';
823
+
824
+ /**
825
+ * Properties for row or column bands
826
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#BandingProperties
827
+ */
828
+ export type BandingProperties = {
829
+ /** The color of the first row/column (takes priority over band colors) */
830
+ headerColorStyle?: ColorStyle;
831
+ /** The color of the last row/column */
832
+ footerColorStyle?: ColorStyle;
833
+ /** The first color that is alternating (required) */
834
+ firstBandColorStyle?: ColorStyle;
835
+ /** The second color that is alternating (required) */
836
+ secondBandColorStyle?: ColorStyle;
837
+ };
838
+
839
+ /**
840
+ * A banded (alternating colors) range in a sheet
841
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#BandedRange
842
+ */
843
+ export type BandedRange = {
844
+ /** The id of the banded range */
845
+ bandedRangeId?: Integer;
846
+ /** The range over which these properties are applied */
847
+ range?: GridRange;
848
+ /** Properties for row banding */
849
+ rowProperties?: BandingProperties;
850
+ /** Properties for column banding */
851
+ columnProperties?: BandingProperties;
852
+ };
853
+
854
+ /**
855
+ * Strategy for matching developer metadata locations
856
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/DataFilter#DeveloperMetadataLookup.DeveloperMetadataLocationMatchingStrategy
857
+ */
858
+ export type DeveloperMetadataLocationMatchingStrategy =
859
+ | 'DEVELOPER_METADATA_LOCATION_MATCHING_STRATEGY_UNSPECIFIED'
860
+ | 'EXACT_LOCATION'
861
+ | 'INTERSECTING_LOCATION';
862
+
863
+ /**
864
+ * Filter for matching developer metadata
865
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/DataFilter#DeveloperMetadataLookup
866
+ */
867
+ export type DeveloperMetadataLookup = {
868
+ /** Determines how location matching is performed */
869
+ locationType?: DeveloperMetadataLocationType;
870
+ /** Limits the selected metadata to that which has a matching location */
871
+ metadataLocation?: DeveloperMetadataLocation;
872
+ /** Determines how location matching is done */
873
+ locationMatchingStrategy?: DeveloperMetadataLocationMatchingStrategy;
874
+ /** Limits the selected metadata to that which has a matching metadata ID */
875
+ metadataId?: Integer;
876
+ /** Limits the selected metadata to that which has a matching metadata key */
877
+ metadataKey?: string;
878
+ /** Limits the selected metadata to that which has a matching metadata value */
879
+ metadataValue?: string;
880
+ /** Limits the selected metadata to that which has a matching visibility */
881
+ visibility?: DeveloperMetadataVisibility;
882
+ };
883
+
884
+ /**
885
+ * Filter that describes what data should be selected or returned
886
+ * @see https://developers.google.com/sheets/api/reference/rest/v4/DataFilter
887
+ */
888
+ export type DataFilterObject = {
889
+ /** Selects data associated with the developer metadata matching the criteria */
890
+ developerMetadataLookup?: DeveloperMetadataLookup;
891
+ /** Selects data that matches the specified A1 range */
892
+ a1Range?: A1Range;
893
+ /** Selects data that matches the range */
894
+ gridRange?: GridRange;
895
+ };