CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Adding email contacts via database
Pages: [1]

Author Topic: Adding email contacts via database  (Read 2396 times)

eriklegault

  • Guest
Adding email contacts via database
July 15, 2009, 01:16:47 pm
Hello, I am trying to add 3000+ email addresses to civmail as email contacts to be filed into groups for mailing lists. My questions is, is there a way to import my existing database into the civicrm database and have them already defined as groups? In other words, if I import my contacts into the civicrm_contacts table, can I file them as groups within the database to ensure I wont have to manually file them into groups within civicrm? We are talking about LOTS of contacts, so grouping them manually would be almost impossible.

Thank you for any help!  :)


Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Adding email contacts via database
July 15, 2009, 03:10:00 pm

I'm assuming you have group information in your existing database. Currently import does not allow you to assign a contact to multiple groups.

You'll have to use the CiviCRM API and write a script to import the group information from the existing DB into CiviCRM. If you are not familiar with PHP/MySQL consider hiring someone from http://civicrm.org/professional/

if you do write a script, please publish it so others can benefit

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

eriklegault

  • Guest
Re: Adding email contacts via database
July 15, 2009, 04:58:18 pm
I'm not sure I understand, are you saying I need to write a script to automatically file the contacts into groups? Or are you saying that civicrm will not recognize the contacts I import unless I write the script?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Adding email contacts via database
July 15, 2009, 06:37:39 pm

I'm assumign that each contact belongs to more than one group. I would do the following:

1. Use import to import all the contacts

2. Write a script to associate the contact with the groups from your existing DB.

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Adding email contacts via database
July 16, 2009, 12:42:23 pm
Quote from: eriklegault on July 15, 2009, 04:58:18 pm
I'm not sure I understand, are you saying I need to write a script to automatically file the contacts into groups? Or are you saying that civicrm will not recognize the contacts I import unless I write the script?

Alternate approach IF each contact belongs to only one group AND you don't have too many groups .... for each import session (using the built-in import feature) you can assign all contacts in that "set" to a new or existing group. So you'd break your contact input file into separate file - one for each group - and import them.
Protect your investment in CiviCRM by  becoming a Member!

woodybrando

  • I’m new here
  • *
  • Posts: 27
  • Karma: 1
Re: Adding email contacts via database
July 20, 2009, 04:51:08 pm
Hey guys thanks for the suggestions. I'm working with Erik on this. And I think the first question i have is how to merge the lists of emails coming from an access database and an excel database into the civicrm database? Is that something I do in phpmyadmin or is there some sort of module that mass imports contacts through our website?

thanks,
jayson
« Last Edit: July 21, 2009, 10:48:44 am by woodybrando »

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Adding email contacts via database
July 21, 2009, 02:12:22 pm
CiviCRM has a built-in Import facility. You can get an overview in the new online book:

http://en.flossmanuals.net/CiviCRM/ContactsAddingAndImporting
Protect your investment in CiviCRM by  becoming a Member!

woodybrando

  • I’m new here
  • *
  • Posts: 27
  • Karma: 1
Re: Adding email contacts via database
July 27, 2009, 04:22:43 pm
Hey Dave,
Thanks for the pointer. I read over the civicrm online book but I'm still having a real hard time getting my head wrapped around this. So i've exported a spreadsheet from access with first name, last name, email, phone, address. I open it in excel and save it as a .csv then I go to the import contacts page of civicrm and choose the .csv and then I get:

Sorry. A non-recoverable error has occurred.

DB Error: a515ac9c2796ca0e23adbe92c68fc9fc

Database Error Code: Identifier name 'firstnamelastnameemailaddressphone_numberorganization_nameaddressaddresscitystateorprovincepostalcod' is too long, 1059

now i'm sure i'm doing about 10 things wrong and i should probably be embarrassed that I'd even think the above would work but I share my attempt to demonstrate how much of a noob I am to this.  ???

For one, I'm sure I need to match the columns to the fields of the civicrm contacts table. So i exported the civicrm contacts table but I immediately noticed that it's got a hash column and I don't know where that came from or how to populate them???

so i'm kinda stuck. thanks guys for getting me this far. jayson
« Last Edit: July 27, 2009, 04:35:15 pm by woodybrando »

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Adding email contacts via database
July 27, 2009, 04:52:14 pm
Jayson - It sounds like the CSV export is messed up somehow - it should have commas between each column header title, and then between each field value in the output rows.

firstname,lastname,emailaddress, etc.
 
Quote from: woodybrando on July 27, 2009, 04:22:43 pm
For one, I'm sure I need to match the columns to the fields of the civicrm contacts table. So i exported the civicrm contacts table but I immediately noticed that it's got a hash column and I don't know where that came from or how to populate them???

Your Access column headers don't need to match CiviCRM's - you'll get a chance to MAP your columns to CiviCRM columns once you get a valid CSV going. I don't have a copy of Access to see what export settings might be causing this problem - so you may need to do some investigating.

Protect your investment in CiviCRM by  becoming a Member!

woodybrando

  • I’m new here
  • *
  • Posts: 27
  • Karma: 1
Re: Adding email contacts via database
July 27, 2009, 05:09:03 pm
Dave thx, that solved my mental block. Not sure what had gone wrong with the .csv the first time (probably cause i used microsoft excel  :P ) So I opened the .xlsx with openoffice instead and then saved it as a .csv Then imported the new .csv into civicrm and this time it went through to a screen, like you said, where i choose how the columns should be matched up to the civicrm fields. Awesome! thx for the quick reply, jayson

www.lostvalley.org
www.oldchildprojects.com

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Adding email contacts via database

This forum was archived on 2017-11-26.