Upload data into Datawrapper using a .csv (comma separated values)
To upload data into Datawrapper we you have three options, listed here based on ease of use:
- Easy: Copy clean, preferably unformatted data from a spreadsheet, then paste this into the first step (blank field)
- Sometimes better, faster, depending on where the data comes from: Upload a file in the csv-format (.csv, comma separated values) format
- When you have constantly changing data and don't want to re-publish the charts:
Link to an external data source (which is useful e.g. with election data). Separate tutorial here.
This tutorial goes a bit deeper into when to use .csv files.
When to use .csv files
A .csv is simply an exchange format for data between spreadsheet applications. The file is stripped of all formatting elements - such as text in bold, italic or different font sizes.
This upload option is useful when you want to export data from applications where the full data is not shown, like in a spreadsheet.
Applications which export .csv files which you can upload into Datawrapper:
- Microsoft Excel
- Google Sheets (this links to a post on Stackoverflow describing a number of workflows handling .csv files)
- Libre Office
- Tabula (a helpful, easy to use tool to extract data from a PDF into a .csv again)
- Open Refine (a tool to clean large datasets, e.g. for consistent writing of U.S.; United States or USA)
- R (a powerful, open source statistic software used for data analysis)
Note: Please let us know if there is a tool you work with regularly which is not listed here.
How Datawrapper reads your data from a .csv
When you upload the data is parsed into Datawrapper. The tool is quite "smart" in detecting your data correctly, so it usually does not matter whether the data is separated by commas, semicolons, tabs or spaces. In step 2 of the Datawrapper workflow you can check after uploading whether the data has been read correctly.
Further, Datawrapper has a number of built-in detection features to check whether the data is either text, a date or a number. You can visually check whether Datawrapper has understood everything as intended:
- Text is aligned left
- Dates are aligned centered
- Numbers are aligned right
Check briefly whether in step 2. If there is a column which has been detected wrongly, you can correct this by clicking on the column.
After the click a menu shows up on the left to let you re-assign the format in the column, as shown in the screenshot below. Note that the years in the X.1 column are aligned center. The numbers in column B through are aligned right.
How to prepare a .csv file before uploading
Most software used for data publication (Microsoft Excel, Google Sheets, Open Refine, R and other statistical software) have a feature to export data as a .csv. Similarly many data sources on the web allow to download data in this format.
Note: In many cases it is better to shortly open the data file first in a spreadsheet software, simply to check.
If everything is ok you can either go back to the .csv file.
You can directly upload it or copy & paste the data into Datawrapper.
How to check a .csv file before uploading
Here are a few simply tips to avoid parsing problems when importing from a .csv file
- Make sure that the .csv file contains a range of columns and lines, with a legend in the first row
- Avoid connected fields which span over several columns, a very common formatting when using data from statistical data sources.
If you find any other issues or helpful tricks when working with .csv files not listed here, please let us know via email@example.com