Transferring Data from Raspberry Pi Pico W to Google Sheets without IFTTT: Part 2

Posted by

Upload Data from Raspberry Pi Pico W to Google Sheets – (Part 2) Without Using IFTTT

In the previous article, we discussed how to upload data from a Raspberry Pi Pico W to Google Sheets using IFTTT. However, if you prefer not to use IFTTT or if you want more control over the data upload process, you can also do it manually. In this article, we will show you how to upload data from a Raspberry Pi Pico W to Google Sheets without using IFTTT.

Setting up Google Sheets API

Before we can start uploading data to Google Sheets, we need to set up the Google Sheets API in the Google Cloud Console. Follow these steps to set up the Google Sheets API:

  1. Go to the Google Cloud Console and create a new project.
  2. Enable the Google Sheets API for your project.
  3. Create credentials for the API and download the JSON file containing the credentials.

Installing the Required Libraries

Next, we need to install the required libraries on the Raspberry Pi Pico W. You can do this by running the following commands in the terminal:

sudo apt-get update
sudo apt-get install python3-pip
pip3 install gspread oauth2client

Uploading Data to Google Sheets

Now that you have set up the Google Sheets API and installed the required libraries, you can start uploading data to Google Sheets. You can use the following Python script:

import gspread
from oauth2client.service_account import ServiceAccountCredentials

scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('path/to/credentials.json', scope)
client = gspread.authorize(creds)

sheet = client.open('Your Google Sheets Document Name').sheet1
sheet.append_row([data_1, data_2, data_3])

Conclusion

By following the steps outlined above, you can upload data from a Raspberry Pi Pico W to Google Sheets without using IFTTT. This method allows you to have more control over the data upload process and customize it according to your needs.

0 0 votes
Article Rating
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@cosmicchaos7891
3 months ago

These tutorials are really helping me in school. Thank You.

Btw does the Pico to mongo method still work?

@Almurabit
3 months ago

Excellent tutorial

@mmshilleh
3 months ago

If I saved you time in this video consider donating to the channel https://www.buymeacoffee.com/mmshilleh

You can view and copy this code at my exclusive Github page for members at
https://github.com/shillehbean/youtube-perks-level-1

You can get access to this by subscribing to perks level 1 on my channel! Thanks, everyone.