50 groups were deleted by mistake. Please don't ask how.

So from a 2 weeks old backup, we're able to extract a CSV from civicrm_group and civicrm_group_contact

group_id, name, contact_id, email

We would like to reimport the groups and their assignation to contacts. The contacts are already in the system normally. We would not want duplicate users

Afraid of simply going to the civicrm_group_contact table and just filling it through phpmyadmin

Any tip? Thanks!


If you are confident the users are all there, you could do an import with the CSV dump you mentioned, using the Group ID and Contact ID.

1) Batch import the groups using the API csv Import module.

2) Assuming the Group IDs could be imported and match up, you could import the users via their internal IDs. Instead of selecting "Group" for the Entity To Import (as in step 1), you can import "GroupContact" and match up the Group ID field and the Contact ID field.

  • Thanks Laryn! Looks promising... I am trying to install it according to this page wiki.civicrm.org/confluence/display/CRMDOC42/Extensions , but I am missing the following menu item : Administer » System Settings » Manage CiviCRM Extensions
    – MastaP
    Apr 24 '15 at 18:14
  • Ok! I was able to hack my way through. But now the API csv Import module does not have a field called "Entity To Import... looks like I can only import contacts.
    – MastaP
    Apr 24 '15 at 18:54
  • Update. We're at 4.2 The API CSV Import only seem to be working for groups on 4.6 ... Any other solution? thanks!
    – MastaP
    Apr 24 '15 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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