• Trustpilot
  • CSV
  • Tutorial

How to export Trustpilot reviews to CSV (Python, pandas and Node.js)

Export all Trustpilot reviews of a company to a CSV that opens cleanly in Excel and Google Sheets, with Python, pandas or Node.js, and keep it up to date.

By ScrapeReviews · · 5 min read

A CSV file is still the fastest way to get reviews in front of people: product managers open it in Excel, analysts load it into a notebook, support leads filter it in Google Sheets. This guide builds a script that exports every Trustpilot review of a company to a clean CSV, first with the Python standard library, then with pandas, then in Node.js, and finally keeps the file up to date without downloading everything again.

What you need

  • An API key: sign up for free and create one in the dashboard, under API keys. Store it in an environment variable called SCRAPEREVIEWS_API_KEY.
  • The company's domain as Trustpilot shows it, for example www.example.com in trustpilot.com/review/www.example.com. If you only know the name, GET /v1/companies/search?query=example returns the matching domains.
  • Python 3.9 or later with requests, or Node.js 18 or later (which has fetch built in).

The data comes from GET /v1/companies/{domain}/reviews, which returns up to 20 reviews per call. You can test it from the terminal before writing any script:

curl "https://api.scrapereviews.com/v1/companies/www.example.com/reviews?limit=5" \
  -H "X-API-Key: $SCRAPEREVIEWS_API_KEY"

The full parameter list is on the reviews endpoint reference. If the API itself is new to you, how to scrape Trustpilot reviews walks through the response and the filters.

Choosing the columns

Each review is a JSON object with nested parts (author, reply). A CSV is flat, so decide on columns up front. These are the ones people actually filter on:

ColumnSource fieldNotes
ididStable, use it to deduplicate
published_atpublished_atISO 8601, UTC
experienced_atexperienced_atDate of the experience, as entered by the reviewer
ratingratingInteger 1 to 5
title, texttitle, textCan contain line breaks and commas
languagelanguageISO 639-1 code
is_verifiedis_verifiedVerified by Trustpilot or the company
likeslikesUseful votes from other readers
author_countryauthor.countryTwo-letter country code
author_reviewsauthor.review_countHow many reviews the author wrote
reply_text, reply_atreply.text, reply.published_atEmpty when the company did not answer
urlurlLink back to the review

Authors have a pseudonymous id (u_...) rather than a name, which keeps personal data out of your spreadsheet.

Python with the csv module

The script follows meta.next_cursor until it is null. Stopping on a short page would be a mistake: a page can hold fewer reviews than limit while more remain.

import csv
import os
import requests

API_URL = "https://api.scrapereviews.com/v1/companies/{domain}/reviews"
HEADERS = {"X-API-Key": os.environ["SCRAPEREVIEWS_API_KEY"]}
COLUMNS = ["id", "published_at", "experienced_at", "rating", "title", "text", "language",
           "is_verified", "likes", "author_country", "author_reviews", "reply_text", "reply_at", "url"]

def fetch_reviews(domain, **filters):
    params = {"limit": 20, **filters}
    while True:
        resp = requests.get(API_URL.format(domain=domain), headers=HEADERS, params=params, timeout=60)
        resp.raise_for_status()
        page = resp.json()
        yield from page["data"]
        if not page["meta"]["next_cursor"]:
            if not page["meta"]["complete"]:
                print("Warning: some slices were capped; narrow with since/until to get the rest")
            return
        params["cursor"] = page["meta"]["next_cursor"]

def to_row(r):
    reply = r["reply"] or {}
    return {
        "id": r["id"], "published_at": r["published_at"], "experienced_at": r["experienced_at"],
        "rating": r["rating"], "title": r["title"], "text": r["text"], "language": r["language"],
        "is_verified": r["is_verified"], "likes": r["likes"],
        "author_country": r["author"]["country"], "author_reviews": r["author"]["review_count"],
        "reply_text": reply.get("text"), "reply_at": reply.get("published_at"), "url": r["url"],
    }

def export(domain, path, **filters):
    with open(path, "w", newline="", encoding="utf-8-sig") as f:
        writer = csv.DictWriter(f, fieldnames=COLUMNS)
        writer.writeheader()
        n = 0
        for n, review in enumerate(fetch_reviews(domain, **filters), 1):
            writer.writerow(to_row(review))
    print(f"{n} reviews written to {path}")

export("www.example.com", "reviews.csv")

Three details in these scripts save you trouble later:

  • newline="" in Python: the csv module writes its own line endings; without it, Windows gets blank lines between rows.
  • Quoting: review texts contain commas, quotes and line breaks. The csv module quotes them for you; in Node.js the cell helper wraps every value in quotes and doubles the inner ones, which is what every spreadsheet expects.
  • utf-8-sig (or the U+FEFF character in Node.js) adds a byte order mark so Excel does not mangle accents, emoji and non-Latin scripts.

Any filter of the endpoint can be passed through: export("www.example.com", "negative.csv", stars="1,2", language="en") exports only the English one- and two-star reviews.

The pandas version

If the next step is analysis rather than a spreadsheet, load the reviews into a DataFrame. json_normalize flattens the nested fields for you (author.country, reply.text), so the column mapping above becomes one line:

import pandas as pd
import requests, os

def fetch_all(domain):
    params, out = {"limit": 20}, []
    while True:
        page = requests.get(f"https://api.scrapereviews.com/v1/companies/{domain}/reviews", params=params,
                            headers={"X-API-Key": os.environ["SCRAPEREVIEWS_API_KEY"]}, timeout=60).json()
        out += page["data"]
        if not page["meta"]["next_cursor"]:
            return out
        params["cursor"] = page["meta"]["next_cursor"]

df = pd.json_normalize(fetch_all("www.example.com"))
df["published_at"] = pd.to_datetime(df["published_at"])
df.to_csv("reviews.csv", index=False, encoding="utf-8-sig")
print(df.groupby(df["published_at"].dt.to_period("M"))["rating"].mean().tail(12))

The last line already answers a common question: how has the average rating moved month by month over the past year?

Prefer not to write the pagination loop at all? The official SDKs do it for you: pip install scrapereviews-sdk gives you client.companies.iter_reviews(domain, ...), a generator that follows the cursor with the same filters and stops at max_reviews if you set one, and npm install scrapereviews gives you the async iterReviews in JavaScript and TypeScript. The Python iterator yields typed review objects, so dataclasses.asdict(review) turns each one back into a dictionary that json_normalize or csv.DictWriter can take. Installation and options are in the SDK documentation.

Opening the file in Excel and Google Sheets

  • Excel: with the byte order mark, a double click is enough. Long texts stay in one cell even when they contain line breaks, because they are quoted. Turn on Wrap Text for the text column and freeze the header row.
  • Excel in some European locales expects semicolons as separators. If everything lands in column A, use Data, From Text/CSV and choose comma as the delimiter instead of changing the file.
  • Google Sheets: File, Import, Upload, then "Replace current sheet" or "Insert new sheet". Sheets detects commas and UTF-8 on its own. Dates in ISO 8601 are recognised as dates once you set the column format.
  • Large files: Google Sheets has a cell limit per spreadsheet, so a company with tens of thousands of long reviews is better analysed in pandas or a database.

Keeping the export up to date

Downloading every review again each day wastes calls. Instead, read the newest date already in the file and ask only for what is newer with since, deduplicating on id since the day boundary overlaps:

import csv

def update(domain, path):
    with open(path, encoding="utf-8-sig") as f:
        existing = list(csv.DictReader(f))
    known = {row["id"] for row in existing}
    newest = max(row["published_at"] for row in existing)[:10]  # YYYY-MM-DD
    new = [to_row(r) for r in fetch_reviews(domain, since=newest) if r["id"] not in known]
    with open(path, "a", newline="", encoding="utf-8") as f:
        csv.DictWriter(f, fieldnames=COLUMNS).writerows(new)
    print(f"{len(new)} new reviews appended")

update("www.example.com", "reviews.csv")

The append uses plain utf-8 on purpose: the byte order mark belongs only at the start of the file. Run it from cron or a scheduled CI job, and a company with a few new reviews a day costs one call per run. Tracking several brands this way is the basis of competitor review monitoring.

What an export costs

One call returns up to 20 reviews and costs one credit; failed calls are free. A company with 2,000 reviews takes about 100 calls, roughly $0.80 at $8 per 1,000 calls, and the daily updates after that are close to free. Details are on the pricing page.

From CSV to insight

Once the reviews are in a table, the natural next step is to find out what people complain about: sentiment analysis of customer reviews in Python starts from the same DataFrame.

ScrapeReviews is an independent service, not affiliated with Trustpilot. Create a free account for 30 free calls a month with no card, and see the examples in the docs for more scripts.

Frequently asked questions

Can I download Trustpilot reviews as CSV without code?
Trustpilot lets a business export its own reviews from its business account. For other companies there is no download button, so you need a script like the one in this article or a tool built on a reviews API.
Why do accents and emoji look broken when I open the CSV in Excel?
Excel assumes an old Windows encoding unless the file starts with a byte order mark. Write the file with the utf-8-sig encoding in Python, or prepend the BOM character in Node.js, and Excel reads it as UTF-8.
How many reviews can I export for free?
Each call returns up to 20 reviews and the first 30 calls of every month are free, so about 600 reviews a month cost nothing. After that it is $8 per 1,000 calls.
How do I update the CSV with new reviews only?
Store the date of the newest review you exported, then call the API with the since parameter set to that date and append the rows whose id you do not have yet. A daily update usually costs a single call per company.

Get the reviews, skip the scraper

30 free calls every month, no credit card. One API key for Trustpilot, the App Store, Google Play, Tripadvisor, Booking.com, Yelp, G2 and Capterra.