• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5  margin: 0;
6  padding: 0;
7  border: 0;
8  font-weight: inherit;
9  font-style: inherit;
10  font-size: 100%;
11  font-family: inherit;
12  vertical-align: baseline;
13}
14
15body {
16  font-size: 13px;
17  padding: 1em;
18}
19
20h1 {
21  font-size: 26px;
22  margin-bottom: 1em;
23}
24
25h2 {
26  font-size: 24px;
27  margin-bottom: 1em;
28}
29
30h3 {
31  font-size: 20px;
32  margin-bottom: 1em;
33  margin-top: 1em;
34}
35
36pre, code {
37  line-height: 1.5;
38  font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42  margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46  font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50  border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54  margin-top: 0.5em;
55}
56
57.firstline {
58  margin-left: 2 em;
59}
60
61.method  {
62  margin-top: 1em;
63  border: solid 1px #CCC;
64  padding: 1em;
65  background: #EEE;
66}
67
68.details {
69  font-weight: bold;
70  font-size: 14px;
71}
72
73</style>
74
75<h1><a href="sheets_v4.html">Google Sheets API</a> . <a href="sheets_v4.spreadsheets.html">spreadsheets</a> . <a href="sheets_v4.spreadsheets.sheets.html">sheets</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78  <code><a href="#copyTo">copyTo(spreadsheetId, sheetId, body, x__xgafv=None)</a></code></p>
79<p class="firstline">Copies a single sheet from a spreadsheet to another spreadsheet.</p>
80<h3>Method Details</h3>
81<div class="method">
82    <code class="details" id="copyTo">copyTo(spreadsheetId, sheetId, body, x__xgafv=None)</code>
83  <pre>Copies a single sheet from a spreadsheet to another spreadsheet.
84Returns the properties of the newly created sheet.
85
86Args:
87  spreadsheetId: string, The ID of the spreadsheet containing the sheet to copy. (required)
88  sheetId: integer, The ID of the sheet to copy. (required)
89  body: object, The request body. (required)
90    The object takes the form of:
91
92{ # The request to copy a sheet across spreadsheets.
93    "destinationSpreadsheetId": "A String", # The ID of the spreadsheet to copy the sheet to.
94  }
95
96  x__xgafv: string, V1 error format.
97    Allowed values
98      1 - v1 error format
99      2 - v2 error format
100
101Returns:
102  An object of the form:
103
104    { # Properties of a sheet.
105    "sheetType": "A String", # The type of sheet. Defaults to GRID.
106        # This field cannot be changed once set.
107    "index": 42, # The index of the sheet within the spreadsheet.
108        # When adding or updating sheet properties, if this field
109        # is excluded then the sheet will be added or moved to the end
110        # of the sheet list. When updating sheet indices or inserting
111        # sheets, movement is considered in "before the move" indexes.
112        # For example, if there were 3 sheets (S1, S2, S3) in order to
113        # move S1 ahead of S2 the index would have to be set to 2. A sheet
114        # index update request will be ignored if the requested index is
115        # identical to the sheets current index or if the requested new
116        # index is equal to the current sheet index + 1.
117    "title": "A String", # The name of the sheet.
118    "gridProperties": { # Properties of a grid. # Additional properties of the sheet if this sheet is a grid.
119        # (If the sheet is an object sheet, containing a chart or image, then
120        # this field will be absent.)
121        # When writing it is an error to set any grid properties on non-grid sheets.
122      "columnCount": 42, # The number of columns in the grid.
123      "frozenRowCount": 42, # The number of rows that are frozen in the grid.
124      "frozenColumnCount": 42, # The number of columns that are frozen in the grid.
125      "hideGridlines": True or False, # True if the grid isn't showing gridlines in the UI.
126      "rowCount": 42, # The number of rows in the grid.
127    },
128    "rightToLeft": True or False, # True if the sheet is an RTL sheet instead of an LTR sheet.
129    "tabColor": { # Represents a color in the RGBA color space. This representation is designed # The color of the tab in the UI.
130        # for simplicity of conversion to/from color representations in various
131        # languages over compactness; for example, the fields of this representation
132        # can be trivially provided to the constructor of "java.awt.Color" in Java; it
133        # can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha"
134        # method in iOS; and, with just a little work, it can be easily formatted into
135        # a CSS "rgba()" string in JavaScript, as well. Here are some examples:
136        #
137        # Example (Java):
138        #
139        #      import com.google.type.Color;
140        #
141        #      // ...
142        #      public static java.awt.Color fromProto(Color protocolor) {
143        #        float alpha = protocolor.hasAlpha()
144        #            ? protocolor.getAlpha().getValue()
145        #            : 1.0;
146        #
147        #        return new java.awt.Color(
148        #            protocolor.getRed(),
149        #            protocolor.getGreen(),
150        #            protocolor.getBlue(),
151        #            alpha);
152        #      }
153        #
154        #      public static Color toProto(java.awt.Color color) {
155        #        float red = (float) color.getRed();
156        #        float green = (float) color.getGreen();
157        #        float blue = (float) color.getBlue();
158        #        float denominator = 255.0;
159        #        Color.Builder resultBuilder =
160        #            Color
161        #                .newBuilder()
162        #                .setRed(red / denominator)
163        #                .setGreen(green / denominator)
164        #                .setBlue(blue / denominator);
165        #        int alpha = color.getAlpha();
166        #        if (alpha != 255) {
167        #          result.setAlpha(
168        #              FloatValue
169        #                  .newBuilder()
170        #                  .setValue(((float) alpha) / denominator)
171        #                  .build());
172        #        }
173        #        return resultBuilder.build();
174        #      }
175        #      // ...
176        #
177        # Example (iOS / Obj-C):
178        #
179        #      // ...
180        #      static UIColor* fromProto(Color* protocolor) {
181        #         float red = [protocolor red];
182        #         float green = [protocolor green];
183        #         float blue = [protocolor blue];
184        #         FloatValue* alpha_wrapper = [protocolor alpha];
185        #         float alpha = 1.0;
186        #         if (alpha_wrapper != nil) {
187        #           alpha = [alpha_wrapper value];
188        #         }
189        #         return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
190        #      }
191        #
192        #      static Color* toProto(UIColor* color) {
193        #          CGFloat red, green, blue, alpha;
194        #          if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
195        #            return nil;
196        #          }
197        #          Color* result = [Color alloc] init];
198        #          [result setRed:red];
199        #          [result setGreen:green];
200        #          [result setBlue:blue];
201        #          if (alpha <= 0.9999) {
202        #            [result setAlpha:floatWrapperWithValue(alpha)];
203        #          }
204        #          [result autorelease];
205        #          return result;
206        #     }
207        #     // ...
208        #
209        #  Example (JavaScript):
210        #
211        #     // ...
212        #
213        #     var protoToCssColor = function(rgb_color) {
214        #        var redFrac = rgb_color.red || 0.0;
215        #        var greenFrac = rgb_color.green || 0.0;
216        #        var blueFrac = rgb_color.blue || 0.0;
217        #        var red = Math.floor(redFrac * 255);
218        #        var green = Math.floor(greenFrac * 255);
219        #        var blue = Math.floor(blueFrac * 255);
220        #
221        #        if (!('alpha' in rgb_color)) {
222        #           return rgbToCssColor_(red, green, blue);
223        #        }
224        #
225        #        var alphaFrac = rgb_color.alpha.value || 0.0;
226        #        var rgbParams = [red, green, blue].join(',');
227        #        return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
228        #     };
229        #
230        #     var rgbToCssColor_ = function(red, green, blue) {
231        #       var rgbNumber = new Number((red << 16) | (green << 8) | blue);
232        #       var hexString = rgbNumber.toString(16);
233        #       var missingZeros = 6 - hexString.length;
234        #       var resultBuilder = ['#'];
235        #       for (var i = 0; i < missingZeros; i++) {
236        #          resultBuilder.push('0');
237        #       }
238        #       resultBuilder.push(hexString);
239        #       return resultBuilder.join('');
240        #     };
241        #
242        #     // ...
243      "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1].
244      "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is,
245          # the final pixel color is defined by the equation:
246          #
247          #   pixel color = alpha * (this color) + (1.0 - alpha) * (background color)
248          #
249          # This means that a value of 1.0 corresponds to a solid color, whereas
250          # a value of 0.0 corresponds to a completely transparent color. This
251          # uses a wrapper message rather than a simple float scalar so that it is
252          # possible to distinguish between a default value and the value being unset.
253          # If omitted, this color object is to be rendered as a solid color
254          # (as if the alpha value had been explicitly given with a value of 1.0).
255      "green": 3.14, # The amount of green in the color as a value in the interval [0, 1].
256      "red": 3.14, # The amount of red in the color as a value in the interval [0, 1].
257    },
258    "hidden": True or False, # True if the sheet is hidden in the UI, false if it's visible.
259    "sheetId": 42, # The ID of the sheet. Must be non-negative.
260        # This field cannot be changed once set.
261  }</pre>
262</div>
263
264</body></html>