How to use CSVs

This article will explain what CSVs/TSVs are, why and how to work with them and how to upload them into Datawrapper.

What are CSVs?

CSV stands for "comma-separated values"; TSV for "tab-separated values". And that's exactly what it is: CSVs/TSVs are a simple exchange format for data, stripped of all formatting elements - such as text in bold, italic or different font sizes. Every data row is a new line, and data cells are separated by commas, semicolon or tab. (We only mention CSVs in our Academy articles, but the two formats are so similar that everything applies to TSVs as well.) 

A lot of the time when working with data, it will be in the CSV or TSV format. Most software used for data analysis (Microsoft Excel, Google Sheets, Open Refine, R and other statistical software) has a feature to export data as a CSV. Similarly, many data sources on the web allow downloading data in this format, like here at Our World in Data when you click at "Data" below any map:

If you click the button, this will download a CSV. You can open it in any text editing software like TextEdit, Microsoft Word, Sublime, Atom, etc. It looks like this:

Entity,Code,Year,Life expectancy (years)
Afghanistan,AFG,1950,27.638
Afghanistan,AFG,1951,27.878
Afghanistan,AFG,1952,28.361
Afghanistan,AFG,1953,28.852
Afghanistan,AFG,1954,29.35
...

If you can, always download data in a CSV format, since it will be in a clean, tidy format that's perfect to work with.

Prepare your CSVs for Datawrapper

Often you'll need or want to change the structure of your data before you can upload it to Datawrapper. Maybe you want to remove some data observations, like certain countries or years. Or maybe your data is in a long format (like the Our World in Data CSV above) – Datawrapper accepts the data only in the wide format in most chart types.

To prepare the data, import your CSV in spreadsheet software like Excel or LibreOffice. E.g. to import your CSV to Google Sheets, create a new file (type "sheets.new" in the URL bar of your browser), then click on File > Import, then select Upload and select the CSV. A pop-up will open:

Choose Replace current sheet or Insert new sheet if your current sheet already contains data. If you downloaded data in another language than your Google Sheet is configured in and you expect that delimiters or dates get misinterpreted by Google Sheet, select No under Convert text to numbers, dates, and formulas. 

👉 To learn how to clean up your data, visit our article "How to prepare your data for analysis and charting in Excel & Google Sheets".
👉 If you want to get data from the long format to the wide format, visit our article "How to get data in the right format with pivot tables".

Upload your data into Datawrapper

You can upload CSVs directly into Datawrapper, or just copy and paste the data once you got the CSV data in Google Sheets. We explain these two ways and two others ways how to upload your data to Datawrapper in this Academy article.