Skip to main content

DataOrigin Package

This package provides core utilities for the DataOrigin project, focusing on leveraging AI-driven data insights for sales prospecting and lead generation in the B2B event space.

Installation

To install the dataorigin package, you can use pip:

pip install dataorigin

Usage

Example usage for google_sheets.py (assuming you have configured credentials using environment variables):

  • GOOGLE_SERVICE_ACCOUNT_JSON: full Service Account JSON as a string (recommended for containers)
  • GOOGLE_APPLICATION_CREDENTIALS: absolute path to Service Account JSON
  • GOOGLE_OAUTH_CLIENT_SECRET_FILE: path to OAuth client secret file (interactive, local dev)
  • GOOGLE_OAUTH_TOKEN_FILE: where to persist OAuth token (default: token.json)
  • GOOGLE_OAUTH_PORT: OAuth local server port (default: 0)
import os
import pandas as pd
from dataorigin.google_sheets import upsert_google_sheet, read_google_sheet

# Example: Write data to a spreadsheet
df = pd.DataFrame([{"a": 1, "b": 2}, {"a": 3, "b": 4}])

res = upsert_google_sheet(
    df=df,
    spreadsheet_id="YOUR_SPREADSHEET_ID",           # or use spreadsheet_title="..."
    sheet_name="data",                              # optional: target sheet (created if missing)
    folder_id=os.getenv("GDRIVE_FOLDER_ID"),         # optional
    clear=True,
    value_input_option="USER_ENTERED",              # "RAW" or "USER_ENTERED"
    rename_sheet=False
)

# Example: Read data from a spreadsheet (reads the first sheet by default)
data = read_google_sheet(spreadsheet_id="YOUR_SPREADSHEET_ID")
print(data)

Low-level Google Sheets helpers

dataorigin.google_sheets also exposes the lower-level building blocks used internally by upsert_google_sheet/read_google_sheet, for callers that need finer control (large uploads, grid resizing, tab discovery from a URL):

  • normalize_spreadsheet_id(value) — extract a spreadsheet id from a URL, or pass a bare id through.
  • get_spreadsheet_id_sheet_id_and_title(sheets, spreadsheet_url) — resolve a URL (with optional gid) to (spreadsheet_id, sheet_id, title, row_count).
  • ensure_sheet_has_rows(sheets, spreadsheet_id, sheet_id, min_rows, grow_by_rows=5000) — grow a sheet's row count when it's below min_rows.
  • set_sheet_row_count(sheets, spreadsheet_id, sheet_id, row_count) — set a sheet's row count to an exact value.
  • trim_sheet_columns(spreadsheet_url, sheet_names=None) — shrink each tab's grid to its last non-empty header column.
  • write_sheet_values_in_batches(spreadsheet_url, df, batch_size, value_input_option, empty_rows_buffer=25, logger=None) — upload a large DataFrame in chunks instead of one request.
  • apply_spreadsheet_oauth_env(default_token_file="token.json") — populate the OAuth2 env vars from app-specific SPREADSHEET_OAUTH2_* aliases.
from dataorigin.google_sheets import _build_services, get_spreadsheet_id_sheet_id_and_title, ensure_sheet_has_rows

sheets, _ = _build_services()
spreadsheet_id, sheet_id, title, row_count = get_spreadsheet_id_sheet_id_and_title(
    sheets, "https://docs.google.com/spreadsheets/d/YOUR_SPREADSHEET_ID/edit#gid=0"
)
ensure_sheet_has_rows(sheets, spreadsheet_id, sheet_id, min_rows=10000)

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Metadata

Release files for dataorigin 1.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dataorigin 1.7.2
File Size Uploaded Provenance Actions
dataorigin-1.7.2.tar.gz 16.6 kB Without provenance Details for dataorigin-1.7.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dataorigin 1.7.2
File Interpreter ABI Platform Actions
dataorigin-1.7.2-py3-none-any.whl Python 3 none any Details for dataorigin-1.7.2-py3-none-any.whl

Total release size: 32.3 kB

Release files / dataorigin-1.7.2.tar.gz

Download URL dataorigin-1.7.2.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d3962254c67536297ce1696333ebcda79231a852747f6f602b714fb18a6a5d71
BLAKE2b-256 checksum
How to use checksums
641b00b3e8ae468e5867c8f415409fb6bc33476c6c969b6b6840317d375a39f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.13

Release files / dataorigin-1.7.2-py3-none-any.whl

Download URL dataorigin-1.7.2-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5d559bd138b07d414f3de44a2c9b794888536c5b1126ca4eb6c72cc26ecaf0b
BLAKE2b-256 checksum
How to use checksums
da5d3478294bd7805c3bbe7ae3cdce9b9c6c5bb091867283529a6ce89660ca6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.13

Security for dataorigin 1.7.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page