Last updated December 23, 2014. Created on May 6, 2013.
Edited by dougvann, Amber Himes Matz, rszrama. Log in to edit this page.

The Feeds module may be used to import Address Field data into entities containing address fields. Address Field stores the individual elements of an address separately (e.g. city, state, postal code), so your data source must differentiate these parts of the address using separate columns or elements.

When configuring your mapper, Feeds lets you select which part of the address field the data source maps to:

There are three important things to keep in mind with respect to address field data:

  1. When importing address data, you should always supply a country value. If your data source does not include a country (whether it's because all addresses come from the same country or some items in the data source have a country while others do not), you should use a module like Feeds Tamper to supply a default value. Address Field currently depends on the country to know if a field value is empty and to know how to build the address field widget form.
  2. Address Field identifies countries using their two character ISO 3166-1 country codes. If your source data uses the full name, you will need to change the way you create your source data or use custom code (perhaps working through Feeds Tamper) to convert the full country name into the corresponding country code.
  3. Address Field identifies administrative areas (i.e. State / Province) using their alphanumeric ISO 3166-2 codes for any country whose address field widget form uses a select list instead of a textfield to specify the administrative area. As above, if your source data uses the full name, you will need to convert the data for import. Address Field does not yet have a solid API for converting one to another, but interested developers can follow this related issue to be updated when it adds one.

For more information on configuring a Feeds importer, refer to the Feeds site builder documentation.

Resources

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

Stomper’s picture

I have a location taxonomy where each term uses the Address Field.

I'm trying to import via Feeds from a CSV into the Address Field of the taxonomy. For some reason, in the Select Target dropdown, I do not see any Address Field subfields.

Am I doing something wrong?

Also how would one use Feeds Temper, explode or implode, to import from a CSV to Address Fields?

hooface’s picture

millionleaves’s picture

I hit an issue where my feed source was supplying the 3 character ISO country code, which broke the import. When I excluded the country field and ran the import again, the rest of the address data was ignored.

My source data was Ubercart for D6, and I was able to use the Feeds SQL module to write a raw query on the UC database that added the 2 character ISO country code instead. This was possible because the uc_countries table in Ubercart stores the country codes in several different formats.

I provide Drupal, Drupal Commerce and CiviCRM development services for customers in New Zealand and beyond