Documentation menu
Docs / Guides / Export results to CSV or a spreadsheet

Export results to CSV or a spreadsheet

Pull records across pages and write them to a CSV you can open in Excel or Sheets.

Pull every matching record from BuildData and write a CSV you can open in Excel or Google Sheets. This loops pages until the results run out.

import csv, requests

URL = "https://builddata-canadian-construction-data-api.p.rapidapi.com/zone"
HEADERS = {"x-rapidapi-host": "builddata-canadian-construction-data-api.p.rapidapi.com", "x-rapidapi-key": "YOUR_RAPIDAPI_KEY"}

rows, offset = [], 0
while True:
    r = requests.get(URL, headers=HEADERS, params={"limit": 100, "offset": offset}).json()
    batch = r.get("results", [])
    if not batch:
        break
    rows += batch
    offset += 100

with open("export.csv", "w", newline="") as f:
    w = csv.DictWriter(f, fieldnames=rows[0].keys())
    w.writeheader()
    w.writerows(rows)

Swap in the filters from the endpoint's reference page to export exactly the slice you want.

Ready to build?Subscribe on RapidAPI to get your key and start calling BuildData in minutes.
Get your API key →