APITube Help Center

How to Export News to CSV or Excel

Add export=csv or export=xlsx to any /v1/news/everything search to download a spreadsheet

Jacob Partington

Written by Jacob Partington

June 27, 2026

Open this example in the API Playground ↗

How to export news to CSV or Excel

To export APITube News API results to CSV or Excel, add export=csv or export=xlsx to your request to /v1/news/everything. Instead of the usual JSON, the API returns a spreadsheet file built from the same articles your filters select — one row per article and 28 fixed columns — so you can open it directly in Excel, Google Sheets or Numbers.

curl "https://api.apitube.io/v1/news/everything?title=tesla&export=csv&api_key=YOUR_API_KEY" -o results.csv

You can send the key as a header (X-API-Key: YOUR_API_KEY) instead of the api_key parameter. The -o results.csv flag saves the download to a file, because the response is served as an attachment.

How to export search results to CSV

Add export=csv to any /v1/news/everything search. The API responds with Content-Type: text/csv; charset=utf-8 and Content-Disposition: attachment; filename="results.csv", so a browser downloads it as a file rather than displaying it. The first row holds the column headers; every matching article becomes one comma-separated row below it.

Because the export runs after your normal search, the file contains exactly the articles your query returns — every filter still applies. Combine keywords, language and date filters, then add export=csv at the end:

curl "https://api.apitube.io/v1/news/everything?title=electric vehicle&language.code=en&export=csv&api_key=YOUR_API_KEY" -o ev_news.csv

This produces a CSV of English-language headlines about electric vehicles, ready to open in any spreadsheet tool.

How to export to Excel (XLSX)

To get a native Excel workbook instead of plain text, use export=xlsx. The API returns a real .xlsx file (Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, filename="results.xlsx") with a single worksheet named Articles. This is the format to use when you want formatting, filtering and pivot tables in Excel without an import step:

curl "https://api.apitube.io/v1/news/everything?category.id=medtop:04000000&export=xlsx&api_key=YOUR_API_KEY" -o financial_news.xlsx

A tab-separated variant is also available with export=tsv (Content-Type: text/tab-separated-values, filename="results.tsv"), which is handy when your article fields already contain commas.

What columns are in the exported file?

CSV, XLSX and TSV all share the same 28 columns, in this order: ID, Href, PublishedAT, Title, Description, Body, Language, Author, Image, Categories, Topics, Industries, Entities, Source, Sentiment, Summary, Keywords, Links, Media, Story, IsDuplicate, IsAccessibleForFree, IsBreaking, ReadTime, SentencesCount, ParagraphsCount, WordsCount and CharactersCount.

Simple values (title, language, read time) appear as plain text or numbers. Nested fields that are objects or lists in JSON — Categories, Topics, Industries, Entities, Sentiment, Media, Links and Keywords — are serialized as JSON strings inside a single cell, so no data is lost when the article is flattened into a row.

Which endpoints support CSV and Excel export?

The export parameter works on the article-returning news endpoints, not just everything. You can add export=csv or export=xlsx to /v1/news/everything, /v1/news/top-headlines, /v1/news/local, /v1/news/story/:id, /v1/news/article, /v1/news/entity, /v1/news/category, /v1/news/topic and /v1/news/industry. The same filters and the same 28-column layout apply on each one.

How to control how many rows you get

Each request exports the current page of results, so use page and per_page to control the file size. One request returns up to 250 rows (per_page max 250); asking for more returns HTTP 400 with error ER0171 (“Limit is out of range”). The default is 100 rows per page. To pull a larger dataset, raise per_page toward the limit and page through the results:

curl "https://api.apitube.io/v1/news/everything?title=tesla&per_page=250&page=2&export=csv&api_key=YOUR_API_KEY" -o results_page2.csv

For the full rules on page and per_page, see How to paginate through results. The canonical parameter list is in the official News API parameter reference.

Common Questions

Is CSV or XLSX export available on every plan?

Yes. Export is a formatting step applied to whatever your search already returns — it is not a separate paid feature. The export request counts as one normal request against your quota, exactly like the JSON version of the same search.

How does export interact with field selection (fl)?

Field selection runs before the export step. If you also pass an fl parameter to narrow the fields returned, the spreadsheet still has all 28 columns, but the columns you excluded come through empty. To get a fully populated file, run the export without fl.

What other export formats are available?

Alongside csv, xlsx and tsv, the export parameter accepts rss, xml, jsonl (with the alias ndjson) and parquet. To turn a search into a subscribable feed instead of a download, see How to turn a news search into an RSS feed. Omit export, or set export=json, to get the default JSON response.

What happens if I pass an unknown export value?

An unrecognized export value is ignored and the API falls back to the standard JSON response. Only the documented formats (csv, tsv, xml, rss, xlsx, jsonl/ndjson, parquet) change the output; anything else returns JSON.


Related Articles