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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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