How to import data from a MySQL database
By downloading your database table as a CSV file, you can import it to Gravity Forms using GravityImport.
Watch this video for a full tutorial on how to do this:
This article is based on the video from GravityKit Live!, using the example CSV structure from the demo. For a generic getting started, check out Getting Started with GravityImport: How to Import Entries into Gravity Forms.
If you have a database table you want to move intoย Gravity Formsย (instead of keeping it in a database table), you can use theย GravityImportย addโon to create a new form and import the data automatically.
Prerequisites #
- A WordPress site withย Gravity Formsย installed and activated.
- GravityKit Import Entriesย addโon installed and activated.
- A CSV export of your database table.
1. Export Your Database Table to CSV #
- Open your database in your preferred database manager.
- Locate the table you want to export.
Use the export function to save it as aย CSV file.
(Most database tools have an โExportโ or โDownload as CSVโ option.)
2. Open the GravityImport “Import Entries” screen #
Log into your WordPress admin dashboard, then:
Navigate toย the Forms menu, clickย Import/Export, then selectย Import Entries.
(If using the GravityKit demo site, visit:ย gravityimport.try.gravitykit.com).
- Ensure theย Import Entriesย addโon is activated.
3. Upload Your CSV File #
- In theย Upload CSVย field, clickย Choose Fileย and select your exported CSV.
- Chooseย Create a New Form.
- Give the form a name (e.g.,ย “Imported Form”).
4. Map CSV Columns to Gravity Forms Fields #
GravityImport will read your CSV columns and let you choose theย Gravity Forms field typeย for each.
- Forย First Nameย andย Last Name, choose theย Nameย field type.
- Map CSVย first_nameย โ Name (First)
- Map CSVย last_nameย โ Name (Last)
- For addresses, select theย Addressย field type.
- Map CSV columns toย Address Line 1,ย Address Line 2,ย City,ย State,ย ZIP.
- If the dataset has columns you donโt need (e.g., County), checkย Do Not Import.
- Mapย Phoneย to theย Phoneย field type.
- Mapย Faxย to theย Phoneย field type.
- Mapย Emailย to theย Emailย field type.
- Mapย Websiteย to theย Website (URL)ย field type.
5. (Optional) Filter Which Rows Are Imported #
You can choose to only import certain rows. For example:
- Only import entries where theย Stateย column isย CA.
6. (Optional) Enable Email Notifications #
If you want Gravity Forms to send notifications (e.g., โForm Submittedโ emails) for imported entries:
- Enableย Email Notifications.
7. Complete the Import #
- Clickย Create Form and Continue with Import.
- When the process finishes, clickย View Imported Records.
8. Review the Imported Form & Entries #
- Youโll now see your imported entries inย Gravity Formsย with all mapped fields.
- The form is automatically created for you.
- You can also choose to import intoย an existing formย instead of creating a new one.
โ ย Youโve successfully moved your database table data into Gravity Forms!
- Prerequisites
- 1. Export Your Database Table to CSV
- 2. Open the GravityImport “Import Entries” screen
- 3. Upload Your CSV File
- 4. Map CSV Columns to Gravity Forms Fields
- 5. (Optional) Filter Which Rows Are Imported
- 6. (Optional) Enable Email Notifications
- 7. Complete the Import
- 8. Review the Imported Form & Entries