Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .github/workflows/dependabot-auto-merge.yml.OLD

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ admin/i18n/*/flat.txt
#ignore .commitinfo created by ioBroker release script
.commitinfo

coverage
coverage
build

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ This adapter can be used to automatically interact with google sheets.
* [Delete sheets](docs/features/delete-sheets.md)
* [Duplicate sheets](docs/features/duplicate-sheet.md)
* [Read cell](docs/features/read-cell.md)
* [Read cells](docs/features/read-cells.md)
* [Write cell](docs/features/write-cell.md)
* [Write cells](docs/features/write-cells.md)

Expand Down Expand Up @@ -120,6 +121,7 @@ Make sure the Service Account has adequate permissions to write to the spreadshe
### **WORK IN PROGRESS**
-->
### **WORK IN PROGRESS**
- (Thomas Pohl) Added readCells feature: Read multiple cells in one call using A1 notation (e.g. A1:B10), including Blockly block and documentation.
- (copilot) Adapter requires node.js >= 22 now

### 1.0.1 (2026-02-16)
Expand Down
1 change: 1 addition & 0 deletions admin/blockly.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,6 @@ loadJS('../google-spreadsheet/blocks/deleteSheet.js');
loadJS('../google-spreadsheet/blocks/deleteSheets.js');
loadJS('../google-spreadsheet/blocks/duplicateSheet.js');
loadJS('../google-spreadsheet/blocks/readCell.js');
loadJS('../google-spreadsheet/blocks/readCells.js');
loadJS('../google-spreadsheet/blocks/writeCell.js');
loadJS('../google-spreadsheet/blocks/writeCells.js');
56 changes: 56 additions & 0 deletions admin/blocks/readCells.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
'use strict';
/*global Blockly */
/*global getInstances */
/*global getInstanceAndAlias */

/// --- Read Cells --------------------------------------------------

Blockly.Words['google-spreadsheet_readcells_read-from'] = { en: 'read from', de: 'Lies von' };
Blockly.Words['google-spreadsheet_readcells_on-sheetName'] = { en: 'sheet', de: 'Tabellenblatt' };
Blockly.Words['google-spreadsheet_readcells_in-range'] = { en: 'range', de: 'Bereich' };
Blockly.GoogleSheets.blocks['google-spreadsheet.readCells'] =
'<block type="google-spreadsheet.readCells">' +
' <field name="INSTANCE"></field>' +
' <value name="SHEET_NAME">' +
' <shadow type="text">' +
' <field name="TEXT">text</field>' +
' </shadow>' +
' </value>' +
' <value name="RANGE">' +
' <shadow type="text">' +
' <field name="TEXT">A1:A7</field>' +
' </shadow>' +
' </value>' +
'</block>';

Blockly.Blocks['google-spreadsheet.readCells'] = {
init: function () {
const instances = getInstances(false);

this.appendDummyInput('NAME')
.appendField(Blockly.Translate('google-spreadsheet_readcells_read-from'))
.appendField(new Blockly.FieldDropdown(instances), 'INSTANCE');

this.appendValueInput('SHEET_NAME').appendField(Blockly.Translate('google-spreadsheet_readcells_on-sheetName'));

this.appendValueInput('RANGE').appendField(Blockly.Translate('google-spreadsheet_readcells_in-range'));

this.setInputsInline(true);
this.setPreviousStatement(false, null);
this.setNextStatement(false, null);
this.setOutput(true, 'Array');

this.setColour(Blockly.GoogleSheets.HUE);
},
};

Blockly.JavaScript.forBlock['google-spreadsheet.readCells'] = function (block) {
const { instance, alias } = getInstanceAndAlias(block);
const sheetName = Blockly.JavaScript.valueToCode(block, 'SHEET_NAME', Blockly.JavaScript.ORDER_ATOMIC);
const range = Blockly.JavaScript.valueToCode(block, 'RANGE', Blockly.JavaScript.ORDER_ATOMIC);

return [
`await new Promise((resolve)=>{sendTo("google-spreadsheet${instance}", "readCells", {sheet: ${sheetName}, range: ${range}, alias: "${alias}"}, (response)=>{resolve(response)}, (response)=>{console.log('Error: ' + response.error); resolve([]);}); })`,
Blockly.JavaScript.ORDER_ATOMIC,
];
};
Loading
Loading