See video version of the tutorial

CSV, or “comma-separated-values” format is very wide-spread, because it’s very simple, lightweight, and almost any software can generate it, or users can even create it manually. Basically, it’s just a text file, where cells are separated with commas, rows are separated with new lines, and first line contains table headers. CSV was supported by wpDataTables from the very first release.

You can download the file that was used to generate this table from this link. The table rendered from this file is below.

See the step-by-step tutorial below the table.

CSV wpDataTable example



When working with CSV-based wpDataTables please note: this format is fine only till a certain limit (no exact limit, but let’s say 3000-5000 cells), if you have a larger file, the page load time will increase. For large data sets it makes sense to import the data to MySQL, you can use wpDataTables Table Constructor to do this

Step 1 - Create a CSV file with your data set

The first thing you would need to do to create a CSV-based table in WordPress is to create the CSV file with your data set in your favourite software. It can be MS Excel, OpenOffice, LibreOffice, Numbers, Google Spreadsheet, or any other. We used LibreOffice.

Save it at some location where you can easily find it later.

CSV table in WordPress

Step 2 - Create a wpDataTable and upload your CSV file

After you saved the CSV file with your data, the next step is to go to your WordPress admin and create a new wpDataTable from CSV data source.

Go to your WordPress admin, and open wpDataTables -> Add from data source.

Add a new CSV-based wpDataTable

When the “Add new wpDataTable” page opens, you would need to do the following:

  1. Set some name for your new wpDataTable that will help you to find the table later.
  2. Choose “CSV file” as the “Table Type“.
  3. Click “Upload file” near the Input file, the WordPress Media Library pop-up will appear.
  4. Upload the CSV file that you prepared in the Step 1, and click the Use in wpDataTable button.
  5. Click Save so that wpDataTables would read the CSV file that you uploaded, and initialize the columns metadata.
csv-3
CSV table in WordPress

Step 3 - (Optional) - Define additional column and table settings

Every time you create a new wpDataTables, it’s smart engine would try to “guess” each of the the column types, and usually it guesses correctly. Anyhow, you can re-define the table settings and each of the column’s settings manually.

In this case we defined “Creation date” column filter type as “Date range“, “Yearly revenue” column filter type as “Number range“, also set the “Display text before” for this column as “$” so each cell would have a currency sign, also we disabled the filter (set to “None“) for the column “Phone number“.

Using CSV tables in WordPress

Step 4 - Insert the wpDataTable in your page or post

When configuration of your CSV-based wpDataTable is finished, you just need to insert it to your post or page.

Open (or create a new) a WordPress post or page, place the cursor in the position where you would like to insert your table, click the “Insert a wpDataTable” button in the MCE editor panel, and choose the CSV-based table that you prepared.

Using CSV tables in WordPress
Choose a CSV file to use in your WordPress post or page

Or, if you prefer to do things manually, you can just copy&paste the wpdatatable shortcode (you can find it in the wpDataTables browse page, or in wpDataTable edit page).

Voila, that’s it!

Additionally, if you want to learn more about different table settings you can read through this documentation section, and this documentation section about different column features.

Never miss new features!

Join 2000+ newsletter subscribers

Never miss notifications about new cool features, promotions, giveaways or freebies - subscribe to our newsletter! We send about one mail per month, and do our best to keep our announcements interesting.

We never spam or disclose your address to anyone.