I have an excel column with around 1000 values, i need to import all these values into my wordpress database so i can create a small form with a text input and a submit button to let the users to add an input value and check if it exists in the imported values from the database.

What is the best way to do this, do i have to create a new table for this column or should i add it to an existing table?

1 Answer 1


There is some way to import excel to WordPress database. but I have an easy solution to import this file.

  1. Go to convertcsv.com and convert your excel file to JSON.
  2. Create the below files and folders:

Folder: wp-content/plugins/import/

File: wp-content/plugins/import/import.json

File: wp-content/plugins/import/import.php

  1. Then save JSON file to import.json
  2. Put below code in import.php


* Plugin Name: Import
* Plugin URI: https://veronalabs.com
* Description: Import excel data to WordPress
* Author: Mostafa Soufi
* Version: 1.0
* Author URI: https://mostafa-soufi.ir

if ( isset( $_GET['do'] ) and $_GET['do'] == 'import' ) {
    $json = file_get_contents( dirname( __FILE__ ) . '/import.json' );

    if ( $json ) {
        $data = json_decode( $json, true );

        // Print your data
        echo '<pre>' . print_r( $data, 1 ) . '</pre>';

        // Each data
        foreach ( $data as $item ) {
            // Create post object
            $args = array(
                'post_title'   => $item['title'], // your column
                'post_content' => $item['content'], // your column
                'post_status'  => 'publish',
                'post_type'    => 'post',
                'post_author'  => 1

            // Insert the post into the database
            //$post_id = wp_insert_post( $args );

  1. Go to Plugins and enable Import plugin. then run this request in your WordPress:


Don't forget, you should get valid data from your json. You can see this data through print_r before each data.

  • @tarek Do you check that? Nov 29, 2017 at 13:17
  • First thanks for your answer, but is this will create a post for each value in the column?
    – Tarek
    Dec 5, 2017 at 15:35
  • Each row in the excel creating a post. Dec 5, 2017 at 16:12
  • What if i had 100,000 rows, is there another method to import this data one time without creating post for each row?
    – Tarek
    Dec 6, 2017 at 1:19
  • It's possible. What do you need exactly? Dec 6, 2017 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.