---
sidebar_position: 1
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
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Google Sheets]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Set cell values
 Sets sheet cell values



`Function SetCellValues(Val Token, Val Spreadsheet, Val ValueMapping, Val Sheet = "", Val MajorDimension = "COLUMNS") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | Token | --token | String | &#x2714; | Token |
  | Spreadsheet | --spreadsheet | String | &#x2714; | SpreadsheetID |
  | ValueMapping | --data | Map Of KeyAndValue | &#x2714; | Fill data where the key is the cell name like A1 |
  | Sheet | --sheetname | String | &#x2716; | Sheet name (first sheet by default) |
  | MajorDimension | --dim | String | &#x2716; | Main dimension when filling the array range |

  
  Returns:  Map Of KeyAndValue - serialized JSON response from Google



```bsl title="1C:Enterprise/OneScript code example"
    Token       = "ya29.a0Aa7pCA9fmPZk2eeWvC-VVPtSY4UzLqhBxacbBQw80RgQUw_wRm7_TGYppXdco1mWX6DVhkJklByQ4epXj_yOMf3j0BVPvNq966JHEVow5jOasNoGJdGn27Rq4...";
    Spreadsheet = "13mnV79E8MBeQkwzcH3RTikriA3VsFKv89RnBkhGeNZA";
    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);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint gsheets SetCellValues \
             --token "***" \
             --spreadsheet "1_IoZFnecyPhgd9vKjI-1X0zcRV9ctchY5inUHmcKQSQ" \
             --data "{'A1':'ThisIsA1','A2':'ThisIsA2','B2':'ThisIsB2','B3':'ThisIsB3','A3':'ThisIsA3','A4':'ThisIsA4','B1':'ThisIsB1','B4':'ThisIsB4'}" \
             --sheetname "Sheet2"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint gsheets SetCellValues ^
             --token "***" ^
             --spreadsheet "1_IoZFnecyPhgd9vKjI-1X0zcRV9ctchY5inUHmcKQSQ" ^
             --data "{'A1':'ThisIsA1','A2':'ThisIsA2','B2':'ThisIsB2','B3':'ThisIsB3','A3':'ThisIsA3','A4':'ThisIsA4','B1':'ThisIsB1','B4':'ThisIsB4'}" ^
             --sheetname "Sheet2"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "spreadsheetId": "1_IoZFnecyPhgd9vKjI-1X0zcRV9ctchY5inUHmcKQSQ",
 "totalUpdatedRows": 4,
 "totalUpdatedColumns": 2,
 "totalUpdatedCells": 8,
 "totalUpdatedSheets": 1,
 "responses": [
  {
   "spreadsheetId": "1_IoZFnecyPhgd9vKjI-1X0zcRV9ctchY5inUHmcKQSQ",
   "updatedRange": "Sheet2!A1",
   "updatedRows": 1,
   "updatedColumns": 1,
   "updatedCells": 1
  },
  {
   "spreadsheetId": "1_IoZFnecyPhgd9vKjI-1X0zcRV9ctchY5inUHmcKQSQ",
   "updatedRange": "Sheet2!A2",
   "updatedRows": 1,
   "updatedColumns": 1,
   "updatedCells": 1
  },
  {
   "spreadsheetId": "1_IoZFnecyPhgd9vKjI-1X0zcRV9ctchY5inUHmcKQSQ",
   "updatedRange": "Sheet2!B2",
   "updatedRows": 1,
   "updatedColumns": 1,
   "updatedCells": 1
  },
  {
   "spreadsheetId": "1_IoZFnecyPhgd9vKjI-1X0zcRV9ctchY5inUHmcKQSQ",
   "updatedRange": "Sheet2!B3",
   "updatedRows": 1,
   "updatedColumns": 1,
   "updatedCells": 1
  },
  {
   "spreadsheetId": "1_IoZFnecyPhgd9vKjI-1X0zcRV9ctchY5inUHmcKQSQ",
   "updatedRange": "Sheet2!A3",
   "updatedRows": 1,
   "updatedColumns": 1,
   "updatedCells": 1
  },
  {
   "spreadsheetId": "1_IoZFnecyPhgd9vKjI-1X0zcRV9ctchY5inUHmcKQSQ",
   "updatedRange": "Sheet2!A4",
   "updatedRows": 1,
   "updatedColumns": 1,
   "updatedCells": 1
  },
  {
   "spreadsheetId": "1_IoZFnecyPhgd9vKjI-1X0zcRV9ctchY5inUHmcKQSQ",
   "updatedRange": "Sheet2!B1",
   "updatedRows": 1,
   "updatedColumns": 1,
   "updatedCells": 1
  },
  {
   "spreadsheetId": "1_IoZFnecyPhgd9vKjI-1X0zcRV9ctchY5inUHmcKQSQ",
   "updatedRange": "Sheet2!B4",
   "updatedRows": 1,
   "updatedColumns": 1,
   "updatedCells": 1
  }
 ]
}
```
