|
2 | 2 | Update or append the data to Google Sheet, or get the data on Google Sheet.
|
3 | 3 | By using HTTP to execute the Google Apps Script API.
|
4 | 4 | Compatible with ESP32 and ESP8266.
|
| 5 | + |
| 6 | +# Quick Example |
| 7 | +```python |
| 8 | +# Import Library |
| 9 | +from ggsheet import MicroGoogleSheet |
| 10 | +from network import WLAN,STA_IF |
| 11 | + |
| 12 | +# Network Creadential |
| 13 | +ssid = "Change SSID" |
| 14 | +password = "Change Password" |
| 15 | + |
| 16 | +# Connect to Network |
| 17 | +sta_if = WLAN(STA_IF) |
| 18 | +sta_if.active(True) |
| 19 | +if not sta_if.isconnected(): |
| 20 | + print("Connecting to wifi: ", ssid) |
| 21 | + sta_if.connect(ssid, password) |
| 22 | + while not sta_if.isconnected(): |
| 23 | + pass |
| 24 | +print("Connection successful") |
| 25 | + |
| 26 | +# Google Sheet Credential |
| 27 | +google_sheet_url = "https://docs.google.com/spreadsheets/d/xxxxxxxxx/edit#gid=0" |
| 28 | +google_sheet_name = "Sheet1" |
| 29 | +google_app_deployment_id = "xxxxxxxx" |
| 30 | + |
| 31 | +# Create Instance |
| 32 | +ggsheet = MicroGoogleSheet(google_sheet_url,google_sheet_name) |
| 33 | +ggsheet.set_DeploymentID(google_app_deployment_id) |
| 34 | + |
| 35 | +# create the Google App Script file (not necessary if it already exists). |
| 36 | +ggsheet.gen_scriptFile() |
| 37 | + |
| 38 | +# Update the cell (single data into a single cell) |
| 39 | +ggsheet.updateCell(1,1,"Hello this is my first data") |
| 40 | + |
| 41 | +# Get the data from specific cell |
| 42 | +print(ggsheet.getCell(1,1)) |
| 43 | + |
| 44 | +# Append the row (many data into a single row) |
| 45 | +ggsheet.updateRow(1,[1,2,3,"Hello","สวัสดีครับ"]) |
| 46 | + |
| 47 | +# Get all the data from a specific row |
| 48 | +print(ggsheet.getRow(1)) |
| 49 | +``` |
| 50 | + |
| 51 | +# Getting Started |
| 52 | +- Installation |
| 53 | +- How to use |
| 54 | + |
| 55 | +# Usage |
| 56 | +- Update Cell |
| 57 | +- Update Row |
| 58 | +- Update Column |
| 59 | +- Append Row |
| 60 | +- Append Column |
| 61 | +- Get Cell |
| 62 | +- Get Row |
| 63 | +- Get Column |
0 commit comments