Skip to main content

A Python package to load and manage Google Sheets or Excel file data.

Project description

Spreadsheet Manager

Spreadsheet Manager is a lightweight Python package designed for loading and managing data from Google Sheets, fetching data from all tabs within the file. This package provides a simple interface for accessing and storing tabular data in JSON format.


Features

  • Load All Tabs: Fetch data from all tabs within a spreadsheet automatically.
  • Easy to Use: Minimal setup to integrate into your projects.
  • Lightweight: No unnecessary dependencies—uses only pandas and json.

Installation

You can install Spreadsheet Manager via pip:

pip install sheetsmanager

Usage

Initializing the Manager

from sheetsmanager import SheetsManager

# Initialize the SheetsManager with your Google Sheet ID
sheet_id = "your_google_sheet_id"
SheetsManager.init(sheet_id)

The SheetsManager will automatically load all data from all tabs in the spreadsheet upon initialization. Note: The sheet_data and sheet_url variables are static, meaning they are shared across all instances of the SheetsManager class.

Accessing the Loaded Data

# Access the loaded data as a dictionary
print(SheetsManager.sheet_data)  # Dictionary where keys are tab names and values are the tab data

Since sheet_data is a static variable, it will store the data globally, allowing all references to SheetsManager to access the same data.

Reloading the Data

If you want to reload the data from the Google Sheet and update all stored data, you can call the reload() method:

# Reload data from the spreadsheet
SheetsManager.reload()

This will refresh the sheet_data dictionary with the latest data from all tabs. The sheet_data variable is static, so any update will affect all instances that reference it.


Getting the Sheet ID and Generating the URL

To use a Google Sheet with this package, you need the Sheet ID. Follow these steps:

Step 1: Open the Google Sheet

  1. Go to Google Sheets and open your spreadsheet.

Step 2: Retrieve the Sheet ID from the Publish to Web Dialog

  1. Click on File in the top menu.
  2. Select Share > Publish to the web.
  3. In the dialog that opens, you will see the Sheet ID in the generated URL. It looks like this:
    https://docs.google.com/spreadsheets/d/{SHEET_ID}/pub?output=xlsx
    
  4. Copy the part between /d/ and /pub—this is your Sheet ID.

Step 3: Publish the Google Sheet

  1. In the same dialog, choose:
    • Entire Document: To make all tabs available.
    • Microsoft Excel (.xlsx) as the file format.
  2. Click Publish and confirm your choice.

Important Warning

  • Public Access: Publishing makes the spreadsheet accessible to anyone with the link.
  • Read-Only: Others can download the file but cannot directly edit it.

Requirements

  • Python 3.7+
  • pandas

Contributing

Contributions are welcome! If you encounter bugs, have feature requests, or want to contribute code, feel free to submit issues and pull requests on GitHub.


License

Spreadsheet Manager is licensed under the MIT License. See the LICENSE file for more details.

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

sheetsmanager-0.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sheetsmanager-0.0.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file sheetsmanager-0.0.1.tar.gz.

File metadata

  • Download URL: sheetsmanager-0.0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for sheetsmanager-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4e930b25d871c64efaf3d755262d4b8d5a927cb6bdd9389ebab0ea2c9cdc9ea6
MD5 609e3c66a6519dac2da9601d7797465f
BLAKE2b-256 4668ab41213427256ae6cdb987a73358a851a96b9a7b967adf80bc782683126a

See more details on using hashes here.

File details

Details for the file sheetsmanager-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: sheetsmanager-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for sheetsmanager-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2503dee886a5c19032c319f383e20bab35ff7c941e008d2e11bad7a9edee4a66
MD5 f9fe57c2900858c3857700477a868e6f
BLAKE2b-256 3a0f4beb87bfb92fc7a69522daa17b6d3661369956336ae3492b88b7e2c7167a

See more details on using hashes here.

Supported by

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