1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-12-24 00:01:24 +02:00
Files
OpenIntegrations/docs/en/md/Google_Sheets/Data-management/Set-cell-values.mdx

147 lines
4.5 KiB
Plaintext
Raw Normal View History

2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 1
2025-05-05 11:15:20 +03:00
description: Set cell values and other functions to work with Google Sheets in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
2025-05-05 09:49:19 +03:00
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Google Sheets]
2024-10-15 10:16:04 +03:00
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# Set cell values
Sets sheet cell values
`Function SetCellValues(Val Token, Val Spreadsheet, Val ValueMapping, Val Sheet = "", Val MajorDimension = "COLUMNS") Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Token | --token | String | ✔ | Token |
| Spreadsheet | --spreadsheet | String | ✔ | SpreadsheetID |
| ValueMapping | --data | Map Of KeyAndValue | ✔ | Fill data where the key is the cell name like A1 |
| Sheet | --sheetname | String | ✖ | Sheet name (first sheet by default) |
| MajorDimension | --dim | String | ✖ | Main dimension when filling the array range |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON response from Google
<br/>
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2025-09-01 14:51:24 +03:00
Token = "ya29.A0AS3H6NzZhuWUBt5SK1krSUXDl1PlvawSraabkJU9I1Cd9GMbnXV194GtRveLkzC4TFqpg8CjFqwe1CqV-EEU-3BxUGa8srNcXC58Ie1LQOpjFZeSJWCMv7jAn...";
Spreadsheet = "1UQ50_7Akaz0ZfChNPjy1eaPfib19NymIVwPGEKGp5oM";
2024-10-15 10:16:04 +03:00
Sheet = "Sheet2";
ValueMapping = New Map;
ValueMapping.Insert("A1", "ThisIsA1");
ValueMapping.Insert("A2", "ThisIsA2");
ValueMapping.Insert("B2", "ThisIsB2");
ValueMapping.Insert("B3", "ThisIsB3");
ValueMapping.Insert("A3", "ThisIsA3");
ValueMapping.Insert("A4", "ThisIsA4");
ValueMapping.Insert("B1", "ThisIsB1");
ValueMapping.Insert("B4", "ThisIsB4");
Result = OPI_GoogleSheets.SetCellValues(Token, Spreadsheet, ValueMapping, Sheet);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
2024-10-22 08:59:24 +03:00
# JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint gsheets SetCellValues \
2024-10-22 08:59:24 +03:00
--token "***" \
2025-07-15 23:11:07 +03:00
--spreadsheet "1sn3t1HU4qCb03-Ht85AJW4r9Xt3yGlMAq-vRc3pdDlc" \
2024-10-22 08:59:24 +03:00
--data "{'A1':'ThisIsA1','A2':'ThisIsA2','B2':'ThisIsB2','B3':'ThisIsB3','A3':'ThisIsA3','A4':'ThisIsA4','B1':'ThisIsB1','B4':'ThisIsB4'}" \
--sheetname "Sheet2"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
2024-10-22 08:59:24 +03:00
:: JSON data can also be passed as a path to a .json file
2024-10-20 22:36:03 +03:00
oint gsheets SetCellValues ^
2024-10-22 08:59:24 +03:00
--token "***" ^
2025-07-15 23:11:07 +03:00
--spreadsheet "1sn3t1HU4qCb03-Ht85AJW4r9Xt3yGlMAq-vRc3pdDlc" ^
2024-10-22 08:59:24 +03:00
--data "{'A1':'ThisIsA1','A2':'ThisIsA2','B2':'ThisIsB2','B3':'ThisIsB3','A3':'ThisIsA3','A4':'ThisIsA4','B1':'ThisIsB1','B4':'ThisIsB4'}" ^
--sheetname "Sheet2"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"spreadsheetId": "1p_i-5lmOKdBEbi88O0SkXq2Q_gG0c4EY7N_wtWGKSCs",
"totalUpdatedRows": 4,
"totalUpdatedColumns": 2,
"totalUpdatedCells": 8,
"totalUpdatedSheets": 1,
"responses": [
{
"spreadsheetId": "1p_i-5lmOKdBEbi88O0SkXq2Q_gG0c4EY7N_wtWGKSCs",
"updatedRange": "Sheet2!A1",
"updatedRows": 1,
"updatedColumns": 1,
"updatedCells": 1
},
{
"spreadsheetId": "1p_i-5lmOKdBEbi88O0SkXq2Q_gG0c4EY7N_wtWGKSCs",
"updatedRange": "Sheet2!A2",
"updatedRows": 1,
"updatedColumns": 1,
"updatedCells": 1
},
{
"spreadsheetId": "1p_i-5lmOKdBEbi88O0SkXq2Q_gG0c4EY7N_wtWGKSCs",
"updatedRange": "Sheet2!B2",
"updatedRows": 1,
"updatedColumns": 1,
"updatedCells": 1
},
{
"spreadsheetId": "1p_i-5lmOKdBEbi88O0SkXq2Q_gG0c4EY7N_wtWGKSCs",
"updatedRange": "Sheet2!B3",
"updatedRows": 1,
"updatedColumns": 1,
"updatedCells": 1
},
{
"spreadsheetId": "1p_i-5lmOKdBEbi88O0SkXq2Q_gG0c4EY7N_wtWGKSCs",
"updatedRange": "Sheet2!A3",
"updatedRows": 1,
"updatedColumns": 1,
"updatedCells": 1
},
{
"spreadsheetId": "1p_i-5lmOKdBEbi88O0SkXq2Q_gG0c4EY7N_wtWGKSCs",
"updatedRange": "Sheet2!A4",
"updatedRows": 1,
"updatedColumns": 1,
"updatedCells": 1
},
{
"spreadsheetId": "1p_i-5lmOKdBEbi88O0SkXq2Q_gG0c4EY7N_wtWGKSCs",
"updatedRange": "Sheet2!B1",
"updatedRows": 1,
"updatedColumns": 1,
"updatedCells": 1
},
{
"spreadsheetId": "1p_i-5lmOKdBEbi88O0SkXq2Q_gG0c4EY7N_wtWGKSCs",
"updatedRange": "Sheet2!B4",
"updatedRows": 1,
"updatedColumns": 1,
"updatedCells": 1
}
]
}
```