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 | ✔ | 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 |
Returns: Map Of KeyAndValue - serialized JSON response from Google
1C:Enterprise/OneScript code example
Token = "ya29.a0ARW5m7702-Ib_bOq69krqD5iUx89SC2lxGPxRJoBjqvSBqE7uKghOyAjwrL7ebNf6xqPzwD4wQfZlFvBrb7QsWlw5PGW_SvkFr57Y8Js...";
Spreadsheet = "1DoHoA-PGU3xsThA9Uh_rb_oHNpCXhKH0DkirmHTIo9I";
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);
- Bash
- CMD/Bat
# JSON data can also be passed as a path to a .json file
oint gsheets SetCellValues \
--token "***" \
--spreadsheet "1dN30zu99-Z_s0h0XVFANq2SZnfnhrewgLwM71VBIMdQ" \
--data "{'A1':'ThisIsA1','A2':'ThisIsA2','B2':'ThisIsB2','B3':'ThisIsB3','A3':'ThisIsA3','A4':'ThisIsA4','B1':'ThisIsB1','B4':'ThisIsB4'}" \
--sheetname "Sheet2"
:: JSON data can also be passed as a path to a .json file
oint gsheets SetCellValues ^
--token "***" ^
--spreadsheet "1dN30zu99-Z_s0h0XVFANq2SZnfnhrewgLwM71VBIMdQ" ^
--data "{'A1':'ThisIsA1','A2':'ThisIsA2','B2':'ThisIsB2','B3':'ThisIsB3','A3':'ThisIsA3','A4':'ThisIsA4','B1':'ThisIsB1','B4':'ThisIsB4'}" ^
--sheetname "Sheet2"
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
}
]
}