Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 1 | <html><body> |
| 2 | <style> |
| 3 | |
| 4 | body, 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 | |
| 15 | body { |
| 16 | font-size: 13px; |
| 17 | padding: 1em; |
| 18 | } |
| 19 | |
| 20 | h1 { |
| 21 | font-size: 26px; |
| 22 | margin-bottom: 1em; |
| 23 | } |
| 24 | |
| 25 | h2 { |
| 26 | font-size: 24px; |
| 27 | margin-bottom: 1em; |
| 28 | } |
| 29 | |
| 30 | h3 { |
| 31 | font-size: 20px; |
| 32 | margin-bottom: 1em; |
| 33 | margin-top: 1em; |
| 34 | } |
| 35 | |
| 36 | pre, code { |
| 37 | line-height: 1.5; |
| 38 | font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; |
| 39 | } |
| 40 | |
| 41 | pre { |
| 42 | margin-top: 0.5em; |
| 43 | } |
| 44 | |
| 45 | h1, h2, h3, p { |
| 46 | font-family: Arial, sans serif; |
| 47 | } |
| 48 | |
| 49 | h1, 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"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 78 | <code><a href="#copyTo">copyTo(spreadsheetId, sheetId, body=None, x__xgafv=None)</a></code></p> |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 79 | <p class="firstline">Copies a single sheet from a spreadsheet to another spreadsheet.</p> |
| 80 | <h3>Method Details</h3> |
| 81 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 82 | <code class="details" id="copyTo">copyTo(spreadsheetId, sheetId, body=None, x__xgafv=None)</code> |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 83 | <pre>Copies a single sheet from a spreadsheet to another spreadsheet. |
| 84 | Returns the properties of the newly created sheet. |
| 85 | |
| 86 | Args: |
Jon Wayne Parrott | 7d5badb | 2016-08-16 12:44:29 -0700 | [diff] [blame] | 87 | spreadsheetId: string, The ID of the spreadsheet containing the sheet to copy. (required) |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 88 | sheetId: integer, The ID of the sheet to copy. (required) |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 89 | body: object, The request body. |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 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 | |
| 101 | Returns: |
| 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 |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 109 | # is excluded then the sheet is added or moved to the end |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 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 |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 114 | # index update request is ignored if the requested index is |
Jon Wayne Parrott | 692617a | 2017-01-06 09:58:29 -0800 | [diff] [blame] | 115 | # identical to the sheets current index or if the requested new |
| 116 | # index is equal to the current sheet index + 1. |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 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. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 123 | "rowGroupControlAfter": True or False, # True if the row grouping control toggle is shown after the group. |
| 124 | "columnGroupControlAfter": True or False, # True if the column grouping control toggle is shown after the group. |
Thomas Coffee | 2f24537 | 2017-03-27 10:39:26 -0700 | [diff] [blame] | 125 | "frozenRowCount": 42, # The number of rows that are frozen in the grid. |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 126 | "frozenColumnCount": 42, # The number of columns that are frozen in the grid. |
Thomas Coffee | 2f24537 | 2017-03-27 10:39:26 -0700 | [diff] [blame] | 127 | "rowCount": 42, # The number of rows in the grid. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 128 | "hideGridlines": True or False, # True if the grid isn't showing gridlines in the UI. |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 129 | }, |
| 130 | "rightToLeft": True or False, # True if the sheet is an RTL sheet instead of an LTR sheet. |
| 131 | "tabColor": { # Represents a color in the RGBA color space. This representation is designed # The color of the tab in the UI. |
| 132 | # for simplicity of conversion to/from color representations in various |
| 133 | # languages over compactness; for example, the fields of this representation |
| 134 | # can be trivially provided to the constructor of "java.awt.Color" in Java; it |
| 135 | # can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" |
| 136 | # method in iOS; and, with just a little work, it can be easily formatted into |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 137 | # a CSS "rgba()" string in JavaScript, as well. |
| 138 | # |
| 139 | # Note: this proto does not carry information about the absolute color space |
| 140 | # that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, |
| 141 | # DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color |
| 142 | # space. |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 143 | # |
| 144 | # Example (Java): |
| 145 | # |
| 146 | # import com.google.type.Color; |
| 147 | # |
| 148 | # // ... |
| 149 | # public static java.awt.Color fromProto(Color protocolor) { |
| 150 | # float alpha = protocolor.hasAlpha() |
| 151 | # ? protocolor.getAlpha().getValue() |
| 152 | # : 1.0; |
| 153 | # |
| 154 | # return new java.awt.Color( |
| 155 | # protocolor.getRed(), |
| 156 | # protocolor.getGreen(), |
| 157 | # protocolor.getBlue(), |
| 158 | # alpha); |
| 159 | # } |
| 160 | # |
| 161 | # public static Color toProto(java.awt.Color color) { |
| 162 | # float red = (float) color.getRed(); |
| 163 | # float green = (float) color.getGreen(); |
| 164 | # float blue = (float) color.getBlue(); |
| 165 | # float denominator = 255.0; |
| 166 | # Color.Builder resultBuilder = |
| 167 | # Color |
| 168 | # .newBuilder() |
| 169 | # .setRed(red / denominator) |
| 170 | # .setGreen(green / denominator) |
| 171 | # .setBlue(blue / denominator); |
| 172 | # int alpha = color.getAlpha(); |
| 173 | # if (alpha != 255) { |
| 174 | # result.setAlpha( |
| 175 | # FloatValue |
| 176 | # .newBuilder() |
| 177 | # .setValue(((float) alpha) / denominator) |
| 178 | # .build()); |
| 179 | # } |
| 180 | # return resultBuilder.build(); |
| 181 | # } |
| 182 | # // ... |
| 183 | # |
| 184 | # Example (iOS / Obj-C): |
| 185 | # |
| 186 | # // ... |
| 187 | # static UIColor* fromProto(Color* protocolor) { |
| 188 | # float red = [protocolor red]; |
| 189 | # float green = [protocolor green]; |
| 190 | # float blue = [protocolor blue]; |
| 191 | # FloatValue* alpha_wrapper = [protocolor alpha]; |
| 192 | # float alpha = 1.0; |
| 193 | # if (alpha_wrapper != nil) { |
| 194 | # alpha = [alpha_wrapper value]; |
| 195 | # } |
| 196 | # return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; |
| 197 | # } |
| 198 | # |
| 199 | # static Color* toProto(UIColor* color) { |
| 200 | # CGFloat red, green, blue, alpha; |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 201 | # if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 202 | # return nil; |
| 203 | # } |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 204 | # Color* result = [[Color alloc] init]; |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 205 | # [result setRed:red]; |
| 206 | # [result setGreen:green]; |
| 207 | # [result setBlue:blue]; |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 208 | # if (alpha <= 0.9999) { |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 209 | # [result setAlpha:floatWrapperWithValue(alpha)]; |
| 210 | # } |
| 211 | # [result autorelease]; |
| 212 | # return result; |
| 213 | # } |
| 214 | # // ... |
| 215 | # |
| 216 | # Example (JavaScript): |
| 217 | # |
| 218 | # // ... |
| 219 | # |
| 220 | # var protoToCssColor = function(rgb_color) { |
| 221 | # var redFrac = rgb_color.red || 0.0; |
| 222 | # var greenFrac = rgb_color.green || 0.0; |
| 223 | # var blueFrac = rgb_color.blue || 0.0; |
| 224 | # var red = Math.floor(redFrac * 255); |
| 225 | # var green = Math.floor(greenFrac * 255); |
| 226 | # var blue = Math.floor(blueFrac * 255); |
| 227 | # |
| 228 | # if (!('alpha' in rgb_color)) { |
| 229 | # return rgbToCssColor_(red, green, blue); |
| 230 | # } |
| 231 | # |
| 232 | # var alphaFrac = rgb_color.alpha.value || 0.0; |
| 233 | # var rgbParams = [red, green, blue].join(','); |
| 234 | # return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); |
| 235 | # }; |
| 236 | # |
| 237 | # var rgbToCssColor_ = function(red, green, blue) { |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 238 | # var rgbNumber = new Number((red << 16) | (green << 8) | blue); |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 239 | # var hexString = rgbNumber.toString(16); |
| 240 | # var missingZeros = 6 - hexString.length; |
| 241 | # var resultBuilder = ['#']; |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 242 | # for (var i = 0; i < missingZeros; i++) { |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 243 | # resultBuilder.push('0'); |
| 244 | # } |
| 245 | # resultBuilder.push(hexString); |
| 246 | # return resultBuilder.join(''); |
| 247 | # }; |
| 248 | # |
| 249 | # // ... |
| 250 | "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. |
| 251 | "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, |
| 252 | # the final pixel color is defined by the equation: |
| 253 | # |
| 254 | # pixel color = alpha * (this color) + (1.0 - alpha) * (background color) |
| 255 | # |
| 256 | # This means that a value of 1.0 corresponds to a solid color, whereas |
| 257 | # a value of 0.0 corresponds to a completely transparent color. This |
| 258 | # uses a wrapper message rather than a simple float scalar so that it is |
| 259 | # possible to distinguish between a default value and the value being unset. |
| 260 | # If omitted, this color object is to be rendered as a solid color |
| 261 | # (as if the alpha value had been explicitly given with a value of 1.0). |
| 262 | "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. |
| 263 | "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. |
| 264 | }, |
| 265 | "hidden": True or False, # True if the sheet is hidden in the UI, false if it's visible. |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame^] | 266 | "tabColorStyle": { # A color value. # The color of the tab in the UI. |
| 267 | # If tab_color is also set, this field takes precedence. |
| 268 | "themeColor": "A String", # Theme color. |
| 269 | "rgbColor": { # Represents a color in the RGBA color space. This representation is designed # RGB color. |
| 270 | # for simplicity of conversion to/from color representations in various |
| 271 | # languages over compactness; for example, the fields of this representation |
| 272 | # can be trivially provided to the constructor of "java.awt.Color" in Java; it |
| 273 | # can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha" |
| 274 | # method in iOS; and, with just a little work, it can be easily formatted into |
| 275 | # a CSS "rgba()" string in JavaScript, as well. |
| 276 | # |
| 277 | # Note: this proto does not carry information about the absolute color space |
| 278 | # that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, |
| 279 | # DCI-P3, BT.2020, etc.). By default, applications SHOULD assume the sRGB color |
| 280 | # space. |
| 281 | # |
| 282 | # Example (Java): |
| 283 | # |
| 284 | # import com.google.type.Color; |
| 285 | # |
| 286 | # // ... |
| 287 | # public static java.awt.Color fromProto(Color protocolor) { |
| 288 | # float alpha = protocolor.hasAlpha() |
| 289 | # ? protocolor.getAlpha().getValue() |
| 290 | # : 1.0; |
| 291 | # |
| 292 | # return new java.awt.Color( |
| 293 | # protocolor.getRed(), |
| 294 | # protocolor.getGreen(), |
| 295 | # protocolor.getBlue(), |
| 296 | # alpha); |
| 297 | # } |
| 298 | # |
| 299 | # public static Color toProto(java.awt.Color color) { |
| 300 | # float red = (float) color.getRed(); |
| 301 | # float green = (float) color.getGreen(); |
| 302 | # float blue = (float) color.getBlue(); |
| 303 | # float denominator = 255.0; |
| 304 | # Color.Builder resultBuilder = |
| 305 | # Color |
| 306 | # .newBuilder() |
| 307 | # .setRed(red / denominator) |
| 308 | # .setGreen(green / denominator) |
| 309 | # .setBlue(blue / denominator); |
| 310 | # int alpha = color.getAlpha(); |
| 311 | # if (alpha != 255) { |
| 312 | # result.setAlpha( |
| 313 | # FloatValue |
| 314 | # .newBuilder() |
| 315 | # .setValue(((float) alpha) / denominator) |
| 316 | # .build()); |
| 317 | # } |
| 318 | # return resultBuilder.build(); |
| 319 | # } |
| 320 | # // ... |
| 321 | # |
| 322 | # Example (iOS / Obj-C): |
| 323 | # |
| 324 | # // ... |
| 325 | # static UIColor* fromProto(Color* protocolor) { |
| 326 | # float red = [protocolor red]; |
| 327 | # float green = [protocolor green]; |
| 328 | # float blue = [protocolor blue]; |
| 329 | # FloatValue* alpha_wrapper = [protocolor alpha]; |
| 330 | # float alpha = 1.0; |
| 331 | # if (alpha_wrapper != nil) { |
| 332 | # alpha = [alpha_wrapper value]; |
| 333 | # } |
| 334 | # return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; |
| 335 | # } |
| 336 | # |
| 337 | # static Color* toProto(UIColor* color) { |
| 338 | # CGFloat red, green, blue, alpha; |
| 339 | # if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { |
| 340 | # return nil; |
| 341 | # } |
| 342 | # Color* result = [[Color alloc] init]; |
| 343 | # [result setRed:red]; |
| 344 | # [result setGreen:green]; |
| 345 | # [result setBlue:blue]; |
| 346 | # if (alpha <= 0.9999) { |
| 347 | # [result setAlpha:floatWrapperWithValue(alpha)]; |
| 348 | # } |
| 349 | # [result autorelease]; |
| 350 | # return result; |
| 351 | # } |
| 352 | # // ... |
| 353 | # |
| 354 | # Example (JavaScript): |
| 355 | # |
| 356 | # // ... |
| 357 | # |
| 358 | # var protoToCssColor = function(rgb_color) { |
| 359 | # var redFrac = rgb_color.red || 0.0; |
| 360 | # var greenFrac = rgb_color.green || 0.0; |
| 361 | # var blueFrac = rgb_color.blue || 0.0; |
| 362 | # var red = Math.floor(redFrac * 255); |
| 363 | # var green = Math.floor(greenFrac * 255); |
| 364 | # var blue = Math.floor(blueFrac * 255); |
| 365 | # |
| 366 | # if (!('alpha' in rgb_color)) { |
| 367 | # return rgbToCssColor_(red, green, blue); |
| 368 | # } |
| 369 | # |
| 370 | # var alphaFrac = rgb_color.alpha.value || 0.0; |
| 371 | # var rgbParams = [red, green, blue].join(','); |
| 372 | # return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); |
| 373 | # }; |
| 374 | # |
| 375 | # var rgbToCssColor_ = function(red, green, blue) { |
| 376 | # var rgbNumber = new Number((red << 16) | (green << 8) | blue); |
| 377 | # var hexString = rgbNumber.toString(16); |
| 378 | # var missingZeros = 6 - hexString.length; |
| 379 | # var resultBuilder = ['#']; |
| 380 | # for (var i = 0; i < missingZeros; i++) { |
| 381 | # resultBuilder.push('0'); |
| 382 | # } |
| 383 | # resultBuilder.push(hexString); |
| 384 | # return resultBuilder.join(''); |
| 385 | # }; |
| 386 | # |
| 387 | # // ... |
| 388 | "blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1]. |
| 389 | "alpha": 3.14, # The fraction of this color that should be applied to the pixel. That is, |
| 390 | # the final pixel color is defined by the equation: |
| 391 | # |
| 392 | # pixel color = alpha * (this color) + (1.0 - alpha) * (background color) |
| 393 | # |
| 394 | # This means that a value of 1.0 corresponds to a solid color, whereas |
| 395 | # a value of 0.0 corresponds to a completely transparent color. This |
| 396 | # uses a wrapper message rather than a simple float scalar so that it is |
| 397 | # possible to distinguish between a default value and the value being unset. |
| 398 | # If omitted, this color object is to be rendered as a solid color |
| 399 | # (as if the alpha value had been explicitly given with a value of 1.0). |
| 400 | "green": 3.14, # The amount of green in the color as a value in the interval [0, 1]. |
| 401 | "red": 3.14, # The amount of red in the color as a value in the interval [0, 1]. |
| 402 | }, |
| 403 | }, |
Jon Wayne Parrott | 0a471d3 | 2016-05-19 10:54:38 -0700 | [diff] [blame] | 404 | "sheetId": 42, # The ID of the sheet. Must be non-negative. |
| 405 | # This field cannot be changed once set. |
| 406 | }</pre> |
| 407 | </div> |
| 408 | |
| 409 | </body></html> |