Simple get data from Google sheet in form of Pandas dataframe
Project description
Google Sheets to DataFrame
This Python module provides a simple interface to connect to Google Sheets and retrieve data as a pandas DataFrame. It uses the gspread
library to handle Google Sheets API interactions and pandas
for data manipulation.
Prerequisites
Ensure you have the following Python libraries installed:
gspread
pandas
oauth2client
You can install them using pip:
pip install gspread pandas oauth2client
Google Sheets API Setup
- Go to the Google Cloud Console.
- Create a new project (or select an existing one).
- Enable the Google Sheets API and Google Drive API for the project.
- Create credentials for a Service Account and download the JSON key file.
- Share your Google Sheet with the email address in the JSON key file.
Usage
-
Save your Service Account credential JSON file in your project directory.
-
Use the Connect class to fetch data from your Google Sheet:
from sheetconnect import Connect
credential = 'path/to/your/credential.json'
sheet = 'Your Google Sheet Name'
sheet_name = 'Sheet1'
dataframe = Connect.GetDF_Sheet(credential, sheet, sheet_name)
print(dataframe)
Replace 'path/to/your/credential.json', 'Your Google Sheet Name', and 'Sheet1' with your actual file path, Google Sheet name, and worksheet name.
Acknowledgements
- gspread - Google Sheets Python API
- pandas - Data analysis and manipulation library
- oauth2client - OAuth 2.0 client library
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sheetconnect-1.0.2.tar.gz
.
File metadata
- Download URL: sheetconnect-1.0.2.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1f71af0632265cd882eab897b2c1c308b9568fd3ea15c770224d0c77e95d0dd |
|
MD5 | 8207c3131bb3befea01376c01ea98669 |
|
BLAKE2b-256 | 50301d52e0305daafd8a4186a45416fdd6954d06f5fcfeaf1d848b7111b932f6 |
File details
Details for the file sheetconnect-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: sheetconnect-1.0.2-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf7ca4ceafbc0bd4dfcccc4d3935dad23a64a86c1515f92ae1569fd3705e2e77 |
|
MD5 | d3cc9de3817e30d165f84a82b84f51b9 |
|
BLAKE2b-256 | a057ccd57c562143658b48af1f56ae10016e67cee8079ad1484b04d923ea7679 |