How to Export Tweets to CSV or JSON

To export tweets to CSV or JSON, collect them with a scraper such as apidojo's Tweet Scraper V2 on Apify, then download the run's dataset in the format you need: JSON, CSV, Excel, XML, HTML or RSS.

Cover card reading 'How to Export Tweets to CSV or JSON'

To export tweets to CSV or JSON, collect them with a scraper such as apidojo’s Tweet Scraper V2 on Apify, then download the run’s dataset in the format you need: JSON, CSV, Excel, XML, HTML or RSS. X has no export button for search results or other people’s posts. For your own posts, your X archive downloads them as HTML and JSON files.

This guide covers both routes, each export format, and the API call that downloads a dataset in any format. Collecting the tweets in the first place is covered in how to scrape Twitter data in 2026.

How Do You Export Your Own Tweets?

You export your own tweets by requesting your X archive, a download of HTML and JSON files with your profile, posts, media and followers. On the web, go to More, Settings and privacy, Your account, then Download an archive of your data, and confirm your password (X Help Center). The archive arrives as a zip file by email. Searching it is covered in how to search your own tweets.

How Do You Export Any Tweets to CSV?

You export any public tweets to CSV by running an X search query through Tweet Scraper V2 and downloading the dataset as CSV. Listed below are the 4 steps.

  1. Build your search on X, then paste the query into the actor’s searchTerms input.
  2. Run the actor.
  3. Open the run’s Storage tab.
  4. Choose CSV (or another format) and click Download.

Apify datasets export as JSON, CSV, XML, Excel, HTML Table, RSS or JSONL (Apify docs).

Which Export Format Should You Use?

Use CSV or Excel for spreadsheets, and JSON or JSONL for code and databases. The table compares the formats.

Format Best for Note
CSV Google Sheets, Excel, BI tools Nested fields such as author become separate columns
Excel (xlsx) Sharing with non-technical teams Same columns as CSV
JSON Code, APIs, keeping nested structure One array of post objects
JSONL Large datasets, streaming, databases One post per line
XML, HTML, RSS Legacy systems, quick viewing, feeds Rarely needed for tweets

CSV, Excel and HTML exports are limited to 2,000 columns, with column names up to 200 characters; JSON, XML and RSS have no such limit (Apify API docs).

What Columns Does a Tweet Export Contain?

A tweet export contains one row per post with its ID, URL, text, date, language, engagement counts and author details. The fields below come from Tweet Scraper V2’s output example (Apify).

Column Example
id 1728108619189874825
url https://x.com/elonmusk/status/1728108619189874825
text The post text
createdAt Fri Nov 24 17:49:36 +0000 2023
lang en
likeCount, retweetCount, replyCount, quoteCount, bookmarkCount Engagement counts
isReply, isRetweet, isQuote Post type flags
author fields userName, name, followers, following, isVerified

How Do You Download a Dataset Through the API?

Call the Apify dataset items endpoint with a format parameter: json, jsonl, xml, html, csv, xlsx or rss.

curl "https://api.apify.com/v2/datasets/DATASET_ID/items?format=csv&token=$APIFY_TOKEN" -o tweets.csv

In Python, write JSON Lines straight from the client:

import json
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
with open("tweets.jsonl", "w", encoding="utf-8") as f:
    for item in client.dataset("DATASET_ID").iterate_items():
        f.write(json.dumps(item, ensure_ascii=False) + "\n")

The full Python workflow is in how to collect tweets with Python.

How Long Is an Exported Dataset Kept?

Unnamed Apify datasets expire after 7 days, while named datasets are kept indefinitely, so download or name a dataset you want to keep. Rename a dataset from its Actions menu in Apify Console (Apify docs).

Questions people ask

Can you export Twitter search results directly from X?

No, X search has no export; run the same query through a scraper, as shown in how to scrape Twitter search results.

Can you export someone else's tweets to Excel?

Yes, run from:username through Tweet Scraper V2 and download the dataset as Excel.

Why does Excel show tweet IDs wrongly?

Spreadsheets round long numbers; import the id column as text to keep all 19 digits.

Where do you start?

At the apidojo Twitter Scraper.