Menu
Sheets.spreadsheets.sheets.copy To
Copies a single sheet from a spreadsheet to another spreadsheet. Returns the properties of the newly created sheet.
/v4/spreadsheets/{spreadsheetId}/sheets/{sheetId}:copyToUse it in a workflow
- Add a step and choose the Google Sheets connector.
- Pick the Sheets.spreadsheets.sheets.copy To action (under spreadsheets).
- Fill in the fields below, then reference the result from later steps as
{{sheetsSpreadsheetsSheetsCopyTo.response.data}}.
Request
Path parameters
spreadsheetIdstringrequiredThe ID of the spreadsheet containing the sheet to copy.
sheetIdintegerrequiredThe ID of the sheet to copy.
Query parameters
$.xgafvstringV1 error format.
One of12
access_tokenstringOAuth access token.
altstringData format for response.
One ofjsonmediaproto
callbackstringJSONP
fieldsstringSelector specifying which fields to include in a partial response.
keystringAPI key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
oauth_tokenstringOAuth 2.0 token for the current user.
prettyPrintbooleanReturns response with indentations and line breaks.
quotaUserstringAvailable to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
upload_protocolstringUpload protocol for media (e.g. "raw", "multipart").
uploadTypestringLegacy upload protocol for media (e.g. "media", "multipart").
Request body
Enter the body as JSON in the step's Body field.
destinationSpreadsheetIdstringThe ID of the spreadsheet to copy the sheet to.
{
"destinationSpreadsheetId": "string"
}
Response
Returns 200 with an object. Read it in later steps with {{sheetsSpreadsheetsSheetsCopyTo.response.data.<field>}}.
dataSourceSheetPropertiesobjectAdditional properties of a DATA_SOURCE sheet.
columnsarray<object>2 fieldsThe columns displayed on the sheet, corresponding to the values in RowData.
dataExecutionStatusobject4 fieldsThe data execution status. A data execution is created to sync a data source object with the latest data from a DataSource. It is usually scheduled to run at background, you can check its state to tell if an execution completes There are several scenarios where a data execution is triggered to run: * Adding a data source creates an associated data source sheet as well as a data execution to sync the data from the data source to the sheet. * Updating a data source creates a data execution to refresh the associated data source sheet similarly. * You can send refresh request to explicitly refresh one or multiple data source objects.
dataSourceIdstringID of the DataSource the sheet is connected to.
gridPropertiesobjectProperties of a grid.
columnCountinteger (int32)The number of columns in the grid.
columnGroupControlAfterbooleanTrue if the column grouping control toggle is shown after the group.
frozenColumnCountinteger (int32)The number of columns that are frozen in the grid.
frozenRowCountinteger (int32)The number of rows that are frozen in the grid.
hideGridlinesbooleanTrue if the grid isn't showing gridlines in the UI.
rowCountinteger (int32)The number of rows in the grid.
rowGroupControlAfterbooleanTrue if the row grouping control toggle is shown after the group.
hiddenbooleanTrue if the sheet is hidden in the UI, false if it's visible.
indexinteger (int32)The index of the sheet within the spreadsheet. When adding or updating sheet properties, if this field is excluded then the sheet is added or moved to the end of the sheet list. When updating sheet indices or inserting sheets, movement is considered in "before the move" indexes. For example, if there were 3 sheets (S1, S2, S3) in order to move S1 ahead of S2 the index would have to be set to 2. A sheet index update request is ignored if the requested index is identical to the sheets current index or if the requested new index is equal to the current sheet index + 1.
rightToLeftbooleanTrue if the sheet is an RTL sheet instead of an LTR sheet.
sheetIdinteger (int32)The ID of the sheet. Must be non-negative. This field cannot be changed once set.
sheetTypestringThe type of sheet. Defaults to GRID. This field cannot be changed once set.
One ofSHEET_TYPE_UNSPECIFIEDGRIDOBJECTDATA_SOURCE
tabColorobjectRepresents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ...
alphanumber (float)The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0).
bluenumber (float)The amount of blue in the color as a value in the interval [0, 1].
greennumber (float)The amount of green in the color as a value in the interval [0, 1].
rednumber (float)The amount of red in the color as a value in the interval [0, 1].
tabColorStyleobjectA color value.
rgbColorobject4 fieldsRepresents a color in the RGBA color space. This representation is designed for simplicity of conversion to/from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of `java.awt.Color` in Java; it can also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` method in iOS; and, with just a little work, it can be easily formatted into a CSS `rgba()` string in JavaScript. This reference page doesn't carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). By default, applications should assume the sRGB color space. When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5. Example (Java): import com.google.type.Color; // ... public static java.awt.Color fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ? protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); } public static Color toProto(java.awt.Color color) { float red = (float) color.getRed(); float green = (float) color.getGreen(); float blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() .setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / denominator); int alpha = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) .build()); } return resultBuilder.build(); } // ... Example (iOS / Obj-C): // ... static UIColor* fromProto(Color* protocolor) { float red = [protocolor red]; float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value]; } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; } static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return nil; } Color* result = [[Color alloc] init]; [result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha <= 0.9999) { [result setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return result; } // ... Example (JavaScript): // ... var protoToCssColor = function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) { return rgbToCssColor(red, green, blue); } var alphaFrac = rgb_color.alpha.value || 0.0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ',', alphaFrac, ')'].join(''); }; var rgbToCssColor = function(red, green, blue) { var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) { resultBuilder.push('0'); } resultBuilder.push(hexString); return resultBuilder.join(''); }; // ...
themeColorstringTheme color.
One ofTHEME_COLOR_TYPE_UNSPECIFIEDTEXTBACKGROUNDACCENT1ACCENT2ACCENT3ACCENT4ACCENT5ACCENT6LINK
titlestringThe name of the sheet.
{
"dataSourceSheetProperties": {
"columns": [
{
"formula": "string",
"reference": {
"name": "string"
}
}
],
"dataExecutionStatus": {
"errorCode": "string",
"errorMessage": "string",
"lastRefreshTime": "string",
"state": "string"
},
"dataSourceId": "string"
},
"gridProperties": {
"columnCount": 0,
"columnGroupControlAfter": false,
"frozenColumnCount": 0,
"frozenRowCount": 0,
"hideGridlines": false,
"rowCount": 0,
"rowGroupControlAfter": false
},
"hidden": false,
"index": 0,
"rightToLeft": false,
"sheetId": 0,
"sheetType": "SHEET_TYPE_UNSPECIFIED",
"tabColor": {
"alpha": 0,
"blue": 0,
"green": 0,
"red": 0
},
"tabColorStyle": {
"rgbColor": {
"alpha": 0,
"blue": 0,
"green": 0,
"red": 0
},
"themeColor": "THEME_COLOR_TYPE_UNSPECIFIED"
},
"title": "string"
}
Need more? See the Google Sheets guide for connection setup and behaviour shared by every action.