5

I have a CSV that I'd like to import into EE. Looking at exp_channel_fields, I think I am able to connect them to the appropriate columns in exp_channel_data. Basically, it seems like the value in exp_channel_fields.field_id is used to make exp_channel_data.field_id_x (where x is the field_id value).

But there is also this field_ft_x column. What is that for?

Is doing an import as simple as just putting my data in the appropriate columns in exp_channel_data? Is there an easier way to do this?

5 Answers 5

6

Generally the best option is to use DataGrab. It can import from CSV files, as well as XML and other formats.

The field_ft_x column stores the field "type". This is different from the fieldtypes you are probably thinking of though. For example, a "textarea" field has the option to choose which format it's in - things like None, Auto BR, HTML. You can also install new options in the list (and probably have already) such as Markdown.

2
  • The HTML's form field "type?" Why would that be in the exp_channel_data? Wouldn't that just be duplicating data? Nov 30, 2012 at 1:16
  • Oh, I suppose the type could change? Thus, this is more of a historical record of the field type when the data was entered? Nov 30, 2012 at 1:27
10

To add an entry to EE, you need to enter data in a minimum of two places: an entry in exp_channel_titles and a matching one (by entry_id) in exp_channel_data.

The entry_id field is not auto-incremented, and so you're best to enter the data in a transaction, in case the (very rare) circumstance happens where the control panel is used to add an entry just as you're importing the data. Or, you can write a big batch of queries and just start it at an entry_id you know isn't taken already.

There are, of course, circumstances where you have to add data more places: if it's a new author, if your data uses categories, if it uses matrix data (a common third-part add-on), if it has comments...

Each field stores its data in the exp_channel_data column called field_id_##, and the matching field_ft_## column is used to describe how that content should be OUTPUT later by EE. (i.e. field_ft is not a description of how the data is being stored, just of how it should be displayed. Data is usually stored as unformatted as possible.)

Each field has a default format, but every instance (entry) of data for any field can be set within EE to output its content in a variety of ways, so that's why that's there.

It's true, you don't need to use the third-party add-ons suggested here for simple data import needs. But the moment your data gets more complicated, they do a wonderful job of navigating that complexity and resolving data conflicts. Datagrab tends to be updated more often.

3

There are 2 major add-ons for importing csv files (and other filetypes) into EE:

Both work similar, each has its own quirks and extras. A lot depends on properly formatted csv files, and both map to already defined channels/custom fields.

3
  • Are there non-commercial options? Can't I just do this via MySQL? Nov 30, 2012 at 1:13
  • none that I'm aware of. But given the dev time they can save both are well worth the money, especially if you have to do repeated imports. Nov 30, 2012 at 8:18
  • 1
    I would second DataGrab and underline the point about formatting the csv file. The import is easy, the hard bit it getting the file right to start with.
    – foamcow
    Nov 30, 2012 at 11:41
3

+1 DataGrab nice & simple.

0

I've used datagrab lot of time and it works well! It also imports in Playa fields. I only find some problems when I need to assign category/subcategories. I've never use solspace importer but it should be more expensive than datagrab.

Your Answer

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

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