Quadratic Docs
Ask or search…
K
Comment on page

Ingest data

Get the data you want, when you want it.
Ingesting data into spreadsheets can be cumbersome. We believe data ingestion is best performed with programming languages, specifically Python; APIs and databases are the standard data sources for any data team.
Pandas DataFrames are the de-facto data wrangling surface in Quadratic. Once your data has been ingested, getting it into your DataFrame is the obvious first choice. Once in a DataFrame, your data can be returned to the spreadsheet and manipulated outside of Python. In the following examples, we showcase the entire workflow from querying data sources to getting the data into a DataFrame to display in the spreadsheet.

Query API - GET Request

Let's break our GET request down into a few different pieces.
Import the basic requests library you're familiar with, query the API, and get the data into a Pandas DataFrame.
# imports
import requests
import pandas as pd
# request
response = requests.get('your_API_url_here')
# json to DataFrame
df = pd.DataFrame(response.json())
# display DataFrame in the sheet
df

Going from CSV to DataFrame

Bringing your CSV to Quadratic is as simple as a drag and drop. Once your CSV is in the spreadsheet, reference the range of cells in Python to get your data into a DatarFrame.
You use the argument first_row_header=True to avoid the first row of your DataFrame being what is intended to be our header. Note that the output, in this case, is printed to the console since you already have your initial CSV in the sheet. After some manipulation of the data, perhaps you would want to display your new DataFrame. In that case, leave df as the last line of code.
In this case, the spreadsheet reflects cells((0, 0),(0, 160)) since we want the full span of data in both columns 0 and 1 spanning from rows 0 to 160.
df = cells((0,0),(1,160), first_row_header=True)

Query Database - ODBC Connector

Coming soon.

Query Database - PostgreSQL

Coming soon.