Skip to content

Instantly share code, notes, and snippets.

@nickjevershed
nickjevershed / google-sheets-json.py
Last active October 7, 2023 03:18
Python script to convert Google spreadsheets to simple JSON file and save it locally. Assumes your data is on the left-most sheet, ie the default. Spreadsheet needs to be 'published to the web'.
import simplejson as json
import requests
#your spreadsheet key here. I'm using an example from the Victorian election campaign
key = "1THJ6MgfEk-1egiPFeDuvs4qEi02xTpz4fq9RtO7GijQ"
#google api request urls - I'm doing the first one just to get nice key values (there's probably a better way to do this)
url1 = "https://spreadsheets.google.com/feeds/cells/" + key + "/od6/public/values?alt=json"
@willkurt
willkurt / prob_logic.ipynb
Last active September 16, 2021 17:25
Implementing probability as logic using Python's data model methods
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Example script for loading data from a .csv file into your Mozart Snowflake instance.
To use, specify the 6 constants defined at the top:
SNOWFLAKE_ACCOUNT, SNOWFLAKE_USERNAME, SNOWFLAKE_PASSWORD, and SNOWFLAKE_DATABASE come from https://app.mozartdata.com/integrations/mode
TARGET_SCHEMA and TARGET_TABLE are where we'll be writing to
CSV_FILEPATH is the full path to the csv file we'll be uploading
Install snowflake-sqlalchemy: https://docs.snowflake.com/en/user-guide/sqlalchemy.html#installing-snowflake-sqlalchemy
tldr: pip install --upgrade snowflake-sqlalchemy