Migrating Gravity Forms Entries To a Newer/Different Site

Sometimes when we redesign a site (when we know the content doesn’t need to change much) we’ll duplicate the old site and then work on the duplicate until we’re ready to release.  There are potential problems with this approach, including that when you duplicate a site, it’s just a snapshot in time, and any changes made to the live site between the time it’s duplicated and when you release will have to be re-migrated over.  One of the most problematic pieces of content to migrate are Gravity Forms entries, so I thought I’d create an article about how to be able to solve this problem.

  1. First make sure the form has already been recreated on the test site.  If it hasn’t, go to Forms —> Import/Export —> Export Forms (https://YOURSITE.com/wp-admin/admin.php?page=gf_export&subview=export_form), export the form, and then re-import it on the test site.
  2. Next proceed to the live site and export the form entries (https://YOURSITE.com/wp-admin/admin.php?page=gf_export).  Select your form, and then also be sure to select a date range (i.e. the time range from when you duplicated the site to the present)
  3. Next you’ll have to install a free plugin on your test site, “Entries Importing for Gravity Forms”: https://wordpress.org/plugins/entries-importing-for-gravity-forms/ 
  4. Once the plugin is installed and activated, proceed to Gravity Forms and then click Import/Export (https://YOURSITE.com/wp-admin/admin.php?page=gf_export&subview=import_entry).  You’ll see a new option in the left sidebar for “Import Entries”
  5. Next, select the csv file you wish to import, and the form you wish to import to.  Then click Upload
  6. On the ensuing screen, make sure that your csv fields are correctly mapped to the form fields (they should be if the forms are identical).
  7. Click Import and you are done!

Dealing with "There was an issue with the file." errors

I’ve seen this error even when I have a valid file extension, so I simply commented out the code shown below in two files:

  • \wp-content\plugins\entries-importing-for-gravity-forms\src\page-import-entries.php
  • \wp-content\plugins\entries-importing-for-gravity-forms\src\class-viaentriesimport.php
            $fileInfo = wp_check_filetype(basename($uploadedfile['name']));
		//if (empty($fileInfo['ext'])) {
        //    GFCommon::add_error_message('There was an issue with the file.');
        //    return false;
		//}
        

mySQL to Determine Which Forms Have Newer Entries

If you want to be able to get the form ids for every form with newer entries so you know what to export, just execute something along the lines of the following:

            SELECT wpss_gf_entry.form_id FROM wpss_gf_entry
WHERE DATE(wpss_gf_entry.date_created) BETWEEN '2023-01-01' AND '2023-10-31'
GROUP BY wpss_gf_entry.form_id