# Sheets Manager
**Sheets 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 **Sheets Manager** via pip:
```bash
pip install sheetsmanager
```
---
## Usage
### Initializing the Manager
```python
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
```python
# 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:
```python
# 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](https://sheets.google.com/) 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
**Sheets Manager** is licensed under the MIT License. See the LICENSE file for more details.
Raw data
{
"_id": null,
"home_page": null,
"name": "sheetsmanager",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, google-sheets, excel, spreadsheet, spreadsheet manager, sheets manager, google sheets loader, excel loader",
"author": "Yan Sido",
"author_email": "yansido1@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/3c/df/aeccd2a6e48dc01475e340c269b7379f66861122e5888b018a1b86be07db/sheetsmanager-0.0.3.tar.gz",
"platform": null,
"description": "\n# Sheets Manager\n\n**Sheets 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.\n\n---\n\n## Features\n\n- **Load All Tabs**: Fetch data from all tabs within a spreadsheet automatically.\n- **Easy to Use**: Minimal setup to integrate into your projects.\n- **Lightweight**: No unnecessary dependencies\u2014uses only `pandas` and `json`.\n\n---\n\n## Installation\n\nYou can install **Sheets Manager** via pip:\n\n```bash\npip install sheetsmanager\n```\n\n---\n\n## Usage\n\n### Initializing the Manager\n\n```python\nfrom sheetsmanager import SheetsManager\n\n# Initialize the SheetsManager with your Google Sheet ID\nsheet_id = \"your_google_sheet_id\"\nSheetsManager.init(sheet_id)\n```\n\nThe `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.\n\n### Accessing the Loaded Data\n\n```python\n# Access the loaded data as a dictionary\nprint(SheetsManager.sheet_data) # Dictionary where keys are tab names and values are the tab data\n```\n\nSince `sheet_data` is a static variable, it will store the data globally, allowing all references to `SheetsManager` to access the same data.\n\n### Reloading the Data\n\nIf you want to reload the data from the Google Sheet and update all stored data, you can call the `reload()` method:\n\n```python\n# Reload data from the spreadsheet\nSheetsManager.reload()\n```\n\nThis 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.\n\n---\n\n## Getting the Sheet ID and Generating the URL\n\nTo use a Google Sheet with this package, you need the **Sheet ID**. Follow these steps:\n\n### Step 1: Open the Google Sheet\n\n1. Go to [Google Sheets](https://sheets.google.com/) and open your spreadsheet.\n\n### Step 2: Retrieve the Sheet ID from the Publish to Web Dialog\n\n1. Click on `File` in the top menu.\n2. Select `Share` > `Publish to the web`.\n3. In the dialog that opens, you will see the **Sheet ID** in the generated URL. It looks like this:\n ```\n https://docs.google.com/spreadsheets/d/{SHEET_ID}/pub?output=xlsx\n ```\n4. Copy the part between `/d/` and `/pub`\u2014this is your **Sheet ID**.\n\n### Step 3: Publish the Google Sheet\n\n1. In the same dialog, choose:\n - **Entire Document**: To make all tabs available.\n - **Microsoft Excel (.xlsx)** as the file format.\n2. Click `Publish` and confirm your choice.\n\n### Important Warning\n\n- **Public Access**: Publishing makes the spreadsheet accessible to anyone with the link.\n- **Read-Only**: Others can download the file but cannot directly edit it.\n\n---\n\n## Requirements\n\n- Python 3.7+\n- pandas\n\n---\n\n## Contributing\n\nContributions are welcome! If you encounter bugs, have feature requests, or want to contribute code, feel free to submit issues and pull requests on GitHub.\n\n---\n\n## License\n\n**Sheets Manager** is licensed under the MIT License. See the LICENSE file for more details.\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package to load and manage Google Sheets or Excel file data.",
"version": "0.0.3",
"project_urls": null,
"split_keywords": [
"python",
" google-sheets",
" excel",
" spreadsheet",
" spreadsheet manager",
" sheets manager",
" google sheets loader",
" excel loader"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "450b47951922dab9bc0820a5d461fa2352cf6308c6d8f0127065169119f79c86",
"md5": "000ced1876b93d1b6081601d4c779d23",
"sha256": "28035d593bc9c7c2d4d85af6fb2881b0fd94a61944b4e9970a2b1074f8c41599"
},
"downloads": -1,
"filename": "sheetsmanager-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "000ced1876b93d1b6081601d4c779d23",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5502,
"upload_time": "2024-12-31T10:03:05",
"upload_time_iso_8601": "2024-12-31T10:03:05.385025Z",
"url": "https://files.pythonhosted.org/packages/45/0b/47951922dab9bc0820a5d461fa2352cf6308c6d8f0127065169119f79c86/sheetsmanager-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3cdfaeccd2a6e48dc01475e340c269b7379f66861122e5888b018a1b86be07db",
"md5": "8f83e2a88199f23475927c559ec6d983",
"sha256": "ad2a3eb11956a2624deccfb51ebf1eccbfeb30771149892e3d8f752388784113"
},
"downloads": -1,
"filename": "sheetsmanager-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "8f83e2a88199f23475927c559ec6d983",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4361,
"upload_time": "2024-12-31T10:03:07",
"upload_time_iso_8601": "2024-12-31T10:03:07.854020Z",
"url": "https://files.pythonhosted.org/packages/3c/df/aeccd2a6e48dc01475e340c269b7379f66861122e5888b018a1b86be07db/sheetsmanager-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-31 10:03:07",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "sheetsmanager"
}