Creating editable tables by importing data from Excel, CSV or Google Spreadsheets

Video versionA video overview of editable wpDataTables created from CSV

In this tutorial, we will learn how to create editable tables from an Excel or CSV imported data, or from a Google Spreadsheet using DataTables WordPress plugin. Let’s watch a live demo of the imported table first, and then go through the steps needed to create it.

Imported table examplewpDataTable created by importing CSV

In many cases, you might have an initial file with the table data, but this table needs to be regularly updated (e.g. if it is a price list, a catalog, etc.). wpDataTables has two options here for you:

  1.  Creating tables linked to existing data source, in which case you will upload the file and initialize the table, whereupon it will be read every time on page load. Then you can overwrite this file to update the data. Such tables won’t be editable within WordPress, and if they are larger than 3000-5000 rows, the page load and generation time will be slow.
  2. Importing table data to WordPress. The initial data will be read and imported from the provided file or a Google Spreadsheet. You can select to skip certain columns, or add columns. You can edit both the structure and the data within the table at an any point later, but the table won’t be synced with the source file as is the case with the first option; e.g., if you change something in CSV or in source Google Spreadsheet, your wpDataTable data will stay the same because the data will be already imported to the database.

In this tutorial, we will learn how to create a editable tables from an Excel or CSV imported data, or from a Google Spreadsheet. Let’s watch a live demo of the imported table first, and then go through the steps needed to create it.

wdt_IDCompanyPhone numberCreation dateSector
1Cursus In Incorporated(002) 4572644125/11/2003IT
2Adipiscing Company(00606) 774200822/09/2005IT
3Adipiscing Lacus Corporation(05646) 468313108/07/2008IT
4Pede Company(04752) 414533924/12/2007IT
5Ut Cursus Luctus Institute(068) 4024152302/01/2002IT
6Felis Limited(001) 9149796113/07/2004IT
7Sit Amet Industries(087) 1737034615/01/2013IT
8Non Arcu Vivamus Associates(0406) 8275465121/05/2015IT
9Blandit Congue In Limited(07333) 615507202/08/2010IT
10Tortor Company(035889) 95680304/04/2008IT
wdt_IDCompanyPhone numberCreation dateSector

Create a wpDataTable and import your CSV fileStep-by-step guide for importing tables

create table by import

Go to wpDataTables -> Create a Table and choose Create a table by importing data from data source option.

File uploadUploading the file for import

input file path or url

The next step will be to locate the file you want to import using the WordPress Media Library. Click on the “Upload” button to open the Media Library and choose your CSV or Excel file:

Creating Tables in WordPress from CSV

We will use this CSV file to create an editable table. You can download it and use it as well. Importing Excel files is also supported (XLS, XLSX).

To get from Excel to WordPress, you can either upload the file using the WP Media Library, or browse the file that was previously uploaded. After selecting the file click the “Choose file” button.

Google Spreadsheet ConfigurationPreparing the editable Spreadsheet to be used in wpDataTables

If you want to use a Google Spreadsheet first you need to prepare the table data in a Google Spreadsheet. Then Go to File -> Publish to the web and click “Publish”. Copy this link from your browser since you will use it in wpDataTables and paste it in “Input file path or URL”.

Note: if you are going to use a Google Spreadsheet with formulas, please follow this – Tutorial

wpDataTable configConfiguring wpDataTable after import

csv import columns config

Now, wpDataTables will need to “take a look” at the source to initialize the table structure before we can create the actual wpDataTable. To do this, click “Next”. wpDataTables will initialize the column metadata and show you the pre-import table setup screen:

In this screen, you can configure the columns that will be imported, reorder the columns, or skip some columns during the import. You can also change the data type, and even add more columns.
The table name input will be used for wpDataTable name that will help you to identify it later, and can optionally be displayed in the page above the table.
To reorder the columns during the import, drag&drop the column blocks with the mouse.
To remove (ignore) some columns during the import, just click the “X” (“close“) button in the top right of the column block.
To add a column, click the “Add column” button after the column blocks.

For each column you can redefine/define:

Column header – this is a header that will be shown above each column.

Type – this is a single selectbox that defines the column data type, editor input type for the back-end (and front-end) editor, and the filter type.
Possible options:

  • One-line string. This is the simplest text type suitable for short strings. The generated column will have a “string” (“text”) data type, a one-line text input filter type, and a one-line text input editor input type in the editor.
  • Multi-line string. Another option for a text type. This is suitable for longer strings. The generated column will have a string data type, a one-line text input filter type, and a multi-line editor (“memo”) input type.
  • One-line selectbox. This is an option for columns, where cells can have one of several concurrent options as a value (e.g. colors: “red”, “green”, “blue”). The generated column will have a string data type, a select box filter, and a select box editor input.
  • Multi-line selectbox. This is an option for columns, where cells can have several concurrent options as a value (e.g. purchased modules: module 1, module 2, module 3). The generated columns will have a string data type, a select box filter, and a multi-selectbox editor input.
  • Integer. This is an option for integer numeric columns. The generated column will have an integer data type, a number filter, and a text/numeric editor input.
  • Float. This is an option for float numeric columns. The generated column will have a float data type, a number filter, and a masked text/numeric editor input.
  • Date. This is an option for date columns. The generated columns will have a date data type, a date range filter, and a datepicker editor input.
  • URL link. This is an option for URL link columns. The generated columns will have an URL link data type, a text filter, and a text editor input with URL validation.
  • E-mail link. This is an option for E-mail columns. The generated columns will have an e-mail link data type, a text filter and a text editor input type with E-mail address validation.
  • Image. This is an option for image columns. The generated columns will have an Image data type, no filter, and a text editor input.
  • Attachment. This is an option for attachment columns. The generated columns will have a “URL link data type”, no filter, and a “Browse media library” input to attach files.

Default value. This is an optional input, where you can define a default value of the column which will be pre-filled in the editor inputs, and in the filter inputs (which can be disabled). If the column type is One-line selectbox, or Multi-line selectbox, and some possible values are defined (see point #7), this input will become a dropdown of the possible values.

Possible values. This is a “taggable” input, which appears only for One-line selectbox and Multi-line selectbox types. Here you can define all the possible values separating them with a comma.

Data preview shows the data preview (first 4 cells) for the initialized columns. Data preview does not show up for manually added column blocks.

table editor selecetion

To create the wpDataTable, click the “Create the table” button. A dropdown will appear, where you can choose whether you prefer to open the table in the standard editor, or in an Excel-like editor. After choosing one, the wpDataTable will be generated, and you will be redirected to the back-end editor.

You can read more about how to use the back-end editor here.

Do you have the best

essential plugins installed?

Grab the best 46 plugins. Tested and sorted.

Plugins for SEO, Caching, Security, Design and UX, Stats & analytics, Social sharing. Only the best ones.

By clicking "subscribe" you consent that the information you provide via this form will be securely processed and stored in compliance with EU privacy laws (GDPR).

Thank you for subscribing! Please check your inbox to download the WordPress goodies.