Skip to main content

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


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.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

gspreadplusplus-2.0.1-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file gspreadplusplus-2.0.1.tar.gz.

File metadata

  • Download URL: gspreadplusplus-2.0.1.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

Hashes for gspreadplusplus-2.0.1.tar.gz
Algorithm Hash digest
SHA256 e6c26c2995ab481687961c8b8dc92ddd2f657afb45a5ab3b55d345644343adbd
MD5 a961d24b94fc2d61e6faf024921947d9
BLAKE2b-256 46b74bb2ce562b373ffb757a79e75ffee003c9efe1e9fb4be077bcaf08889602

See more details on using hashes here.

File details

Details for the file gspreadplusplus-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gspreadplusplus-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d2455b070df9e0935c9ce1e041b47aee16816f05c525cc98506eebe6f6830a1
MD5 6759b0acd1ecbb75531d8bc4dc4c453a
BLAKE2b-256 8151cb535abc0fad1a81b3773c93559a983b157b6d0174762f8ce3c1d37f769d

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