This adapter can be used to automatically interact with google spreadsheets.
- Append data to spreadsheet
- Delete rows from a spreadsheet
- Create sheets
- Delete sheets
- Duplicate sheets
- Read cell
- Write cell
-
Visit the Google Cloud Console.
-
Create or select an existing project that you wish to use with the API.
-
Enable the Google Spreadsheet API for your project.
For the project you selected in the previous step, create a new service account in Google Cloud IAM by following these steps:
-
Navigate to the IAM & Admin page in the Google Cloud Console.
-
Click on "Service accounts" and then "Create Service Account."
-
Provide a name for the service account and select the role "Project" > "Editor."
-
Click "Continue" to proceed to the next step.
-
On the "Keys" tab, click "Create Key" and choose the format as "JSON." Then click "Continue."
-
Your private key will be generated and automatically downloaded. Keep this file secure as you will need it later.
Open the spreadsheet you want to interact with and share it with the email address of your newly created service account:
-
Open the desired spreadsheet in Google Sheets.
-
Click "Share" in the upper right corner.
-
Enter the email address of the service account in the "Add people" field and grant it the necessary permissions (e.g., "Edit" or "View").
-
Click "Send" to complete the sharing process.
Add the following information to the configuration of your adapter instance in ioBroker:
- Spreadsheet ID - You can find the ID in the URL of your spreadsheet.
- Service Account - The email address of the service account you created.
- Private Key - Open the downloaded JSON file, and locate the private key within the file. Copy only the part starting with "-----BEGIN PRIVATE KEY-----."
To locate the "Spreadsheet ID" in the URL of your Google Sheets document, follow these steps:
- When you open your Google Sheets document in a web browser, the URL in the address bar will look something like this:
https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit
- The "SPREADSHEET_ID" is the long string of characters and numbers between the "/d/" and "/edit" parts of the URL.
Use the available blocks to automatically interact with your spreadsheet.
Error while sending data to Google Spreadsheet:Error: error:0909006C:PEM routines:get_name:no start line
When copying the private key into the configuration, make sure there are no \n. If there are \n in the key, please replace the with normal line breaks
Make sure the Service Account has adequate permissions to write to the spreadsheet. Refer to the "Grant Access to the Spreadsheet" section above.
- (Thomas Pohl) The privateKey is saved now encrypted
- (Thomas Pohl) Support for node.js 22
- (Thomas Pohl) Fixed reading cells and added error handling
- (Thomas Pohl) Added writing of single cells
- (Thomas Pohl) Added reading of single cells
- (Thomas Pohl) Documentation for all features
- (Thomas Pohl) Parsing of private keys is now more robust
- (Thomas Pohl) Preparation for first stable release
- (Thomas Pohl) Improve logging + Code cleanup
Copyright (c) 2024 Thomas Pohl
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.