2024-06-07 13:53:24 +02:00
|
|
|
---
|
|
|
|
sidebar_position: 3
|
|
|
|
---
|
|
|
|
|
2024-06-08 12:46:25 +02:00
|
|
|
# Copy sheet
|
2024-06-07 23:40:04 +02:00
|
|
|
Copies a sheet from one spreadsheet to another
|
2024-06-07 13:53:24 +02:00
|
|
|
|
|
|
|
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
`Function CopySheet(Val Token, Val From, Val Target, Val Sheet) Export`
|
2024-06-07 13:53:24 +02:00
|
|
|
|
|
|
|
| Parameter | CLI option | Type | Destination |
|
|
|
|
|-|-|-|-|
|
|
|
|
| Token | --token | String | Token |
|
2024-06-07 23:40:04 +02:00
|
|
|
| From | --from | String | Source spreadsheet ID |
|
|
|
|
| Target | --to | String | Destination spreadsheet ID |
|
2024-06-07 13:53:24 +02:00
|
|
|
| Sheet | --sheet | String | CopiedSheetID |
|
|
|
|
|
|
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Google
|
|
|
|
|
2024-07-10 13:05:58 +02:00
|
|
|
<br/>
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-07-10 12:58:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-07 13:53:24 +02:00
|
|
|
```bsl title="Code example"
|
2024-07-10 13:24:11 +02:00
|
|
|
|
|
|
|
From = "1Pu07Y5UiGVfW4fqfP7tcSQtdSX_2wdm2Ih23zlxJJwc";
|
2024-06-07 13:53:24 +02:00
|
|
|
Target = "1tPDQHmduH9NASRhy0I-a6--ebNNJ5A6wXhhTRcNhD7s";
|
|
|
|
Sheet = "25093199";
|
|
|
|
|
|
|
|
Response = OPI_GoogleSheets.CopySheet(Token, From, Target, Sheet); //Map
|
|
|
|
Response = OPI_Tools.JSONString(Response); //JSON string
|
|
|
|
```
|
2024-07-10 10:59:55 +02:00
|
|
|
|
|
|
|
|
2024-06-07 13:53:24 +02:00
|
|
|
|
|
|
|
```sh title="CLI command example"
|
|
|
|
|
|
|
|
oint gsheets CopySheet --token %token% --from "1Pu07Y5UiGVfW4fqfP7tcSQtdSX_2wdm2Ih23zlxJJwc" --to "1tPDQHmduH9NASRhy0I-a6--ebNNJ5A6wXhhTRcNhD7s" --sheet "25093199"
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```json title="Result"
|
2024-07-10 13:11:17 +02:00
|
|
|
{
|
2024-06-07 13:53:24 +02:00
|
|
|
"sheetId": 1790807910,
|
|
|
|
"title": "Sheet2 (copy)",
|
|
|
|
"index": 2,
|
|
|
|
"sheetType": "GRID",
|
|
|
|
"gridProperties": {
|
|
|
|
"rowCount": 1000,
|
|
|
|
"columnCount": 26
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|