Skip to main content

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

  1. Go to the Google Cloud Console.
  2. Create a new project (or select an existing one).
  3. Enable the Google Sheets API and Google Drive API for the project.
  4. Create credentials for a Service Account and download the JSON key file.
  5. Share your Google Sheet with the email address in the JSON key file.

Usage

  1. Save your Service Account credential JSON file in your project directory.

  2. 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

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

sheetconnect-1.0.2.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

sheetconnect-1.0.2-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

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

Hashes for sheetconnect-1.0.2.tar.gz
Algorithm Hash digest
SHA256 c1f71af0632265cd882eab897b2c1c308b9568fd3ea15c770224d0c77e95d0dd
MD5 8207c3131bb3befea01376c01ea98669
BLAKE2b-256 50301d52e0305daafd8a4186a45416fdd6954d06f5fcfeaf1d848b7111b932f6

See more details on using hashes here.

File details

Details for the file sheetconnect-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for sheetconnect-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cf7ca4ceafbc0bd4dfcccc4d3935dad23a64a86c1515f92ae1569fd3705e2e77
MD5 d3cc9de3817e30d165f84a82b84f51b9
BLAKE2b-256 a057ccd57c562143658b48af1f56ae10016e67cee8079ad1484b04d923ea7679

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page