Enhanced Google Sheets operations with advanced data type handling
Project description
gspreadplusplus
A Python library that enhances Google Sheets operations with additional functionality and improved data type handling.
Features
- Transfer Spark DataFrames to Google Sheets with proper type conversion
- Intelligent handling of various data types (numbers, dates, timestamps, etc.)
- Preserve or update sheet headers
- Selective column clearing options
- Automatic date formatting
- Sheet dimension management
Installation
pip install gspreadplusplus
Requirements
- Python 3.7+
- gspread
- pyspark
- google-auth
Usage
Basic DataFrame Export
from gspreadplusplus import GPP
from pyspark.sql import SparkSession
# Initialize Spark and create a DataFrame
spark = SparkSession.builder.appName("example").getOrCreate()
df = spark.createDataFrame([
("2024-01-01", 100, "Complete"),
("2024-01-02", 150, "Pending")
], ["date", "amount", "status"])
# Your Google Sheets credentials
creds_json = {
"type": "service_account",
# ... rest of your service account credentials
}
# Export DataFrame to Google Sheets
GPP.df_to_sheets(
df=df,
spreadsheet_id="your_spreadsheet_id",
sheet_name="Sheet1",
creds_json=creds_json
)
Advanced Options
GPP.df_to_sheets(
df=df,
spreadsheet_id="your_spreadsheet_id",
sheet_name="Sheet1",
creds_json=creds_json,
english_locale=True, # Use '.' as decimal separator
keep_header=True, # Preserve existing header row
erase_whole=False # Clear only necessary columns
)
Data Type Support
- Strings
- Integers (regular, long, bigint)
- Floating point numbers (double, float)
- Decimals
- Dates
- Timestamps
- Booleans
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gspreadplusplus-2.0.0.tar.gz
(4.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gspreadplusplus-2.0.0.tar.gz.
File metadata
- Download URL: gspreadplusplus-2.0.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b8b6376b8f30961ab1e2e3d74bec907d97207b88cc3128acc91697ad65a674e
|
|
| MD5 |
c020d46f0f3f45c1922262a39bd4d94c
|
|
| BLAKE2b-256 |
48cff81f8d1067c22b320ad3860f901a197e327ccd4bda940a3214533d082c03
|
File details
Details for the file gspreadplusplus-2.0.0-py3-none-any.whl.
File metadata
- Download URL: gspreadplusplus-2.0.0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
304927e83863ecd7640e3057052e7c880a392c7957a307f6d2e9f1f0504d0e1d
|
|
| MD5 |
f8dbf99388c3ecd412dbfbf4ee2934b7
|
|
| BLAKE2b-256 |
0b0c3fa2013d3e5ada4082879f4e6edf92f31bf0ccffd082680c3ffc38ebe9c3
|