Answers.Body: <p>Can you do import with update flag and on preview screen you can add contacts to group.</p>
  <p><a href="https://i.sstatic.net/Llgwt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Llgwt.png" alt="enter image description here" /></a></p>
  <p>or using URL you can do /civicrm/task/add-to-group?reset=1&amp;cids=119,122,137</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-18T17:49:35.407Z
Answers.Text: That'd work, yep. I'd like something for regular users without import permissions, though. Also it just feels like overkill for what is basically a simple contact ID lookup.
Answers.UserDisplayName: Andrew West
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-18T18:02:40.013Z
Answers.Text: You can do /civicrm/task/add-to-group?reset=1&cids=119,122,137
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-18T17:48:26.227Z
Answers.LastActivityDate: 2024-01-18T18:03:00.963Z
Answers.LastEditDate: 2024-01-18T18:03:00.963Z
Answers.UserDisplayName: Pradeep Nayak
Answers.Body: <p>I see in your comment you're looking for something in the UI, but posting this anyway since might be useful.</p>
  <p>Assuming your csv only has one column:</p>
  <p><code>cv ev '$fp = fopen(&quot;mycsv.csv&quot;, &quot;r&quot;); while (($id = fgets($fp)) !== FALSE) { civicrm_api3(&quot;GroupContact&quot;, &quot;create&quot;, [&quot;contact_id&quot; =&gt; trim($id), &quot;group_id&quot; =&gt; 4]); } fclose($fp);'</code></p>
  <p>Replace &quot;4&quot; with the group id.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-18T17:59:08.730Z
Answers.LastActivityDate: 2024-01-18T17:59:08.730Z
Answers.UserDisplayName: Demerit
Body: <p>I get regular requests to turn an external list of contact IDs into a Civi group. I don't have a nice way of doing this atm.</p>
  <p><strong>Search Builder</strong></p>
  <p>The best approach I have so far is with Search Builder, of all things. I have a little bit of javascript that adds an input and then turns that into a search builder search. This sends the data via POST to the usual search results screen, where you can save it to a group in the normal way. You can do this with tens of thousands of IDs.</p>
  <p><a href="https://i.sstatic.net/EjRmR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EjRmR.png" alt="enter image description here" /></a></p>
  <p>But Search Builder is going away, and it'd be nice to do it in a nice Form Builder screen that doesn't need refreshing.</p>
  <p><strong>Search Kit / Form Builder</strong></p>
  <p>Search Kit can't <em>quite</em> do it. You can't paste in a comma-separated list of IDs:</p>
  <p><a href="https://i.sstatic.net/9BUwj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9BUwj.png" alt="enter image description here" /></a></p>
  <p>(you <em>can</em> paste in comma-separated lists for other fields, just not when it's not a lookup field like Contact ID)</p>
  <p>I thought about making a custom quickform that links to a Search with the values in the URL - but this hits limits of the max length of URLs. And we regularly have tens of thousands of people.</p>
  <p>Any other ideas? Is there any way to send data to Search Kit in the POST?</p>
  
Tags: <searchkit><search-builder>
Title: Best way to go from an Excel list of Contact IDs to a Civi group
ThreadText: # Best way to go from an Excel list of Contact IDs to a Civi group
  
  (Asked by: username_0 on 2024-01-18)
  
  I get regular requests to turn an external list of contact IDs into a Civi group. I don't have a nice way of doing this atm.
  
  **Search Builder**
  
  The best approach I have so far is with Search Builder, of all things. I have a little bit of javascript that adds an input and then turns that into a search builder search. This sends the data via POST to the usual search results screen, where you can save it to a group in the normal way. You can do this with tens of thousands of IDs.
  
  [![enter image description here](https://i.sstatic.net/EjRmR.png)](https://i.sstatic.net/EjRmR.png)
  
  But Search Builder is going away, and it'd be nice to do it in a nice Form Builder screen that doesn't need refreshing.
  
  **Search Kit / Form Builder**
  
  Search Kit can't *quite* do it. You can't paste in a comma-separated list of IDs:
  
  [![enter image description here](https://i.sstatic.net/9BUwj.png)](https://i.sstatic.net/9BUwj.png)
  
  (you *can* paste in comma-separated lists for other fields, just not when it's not a lookup field like Contact ID)
  
  I thought about making a custom quickform that links to a Search with the values in the URL - but this hits limits of the max length of URLs. And we regularly have tens of thousands of people.
  
  Any other ideas? Is there any way to send data to Search Kit in the POST?
  
  **Tags:** searchkit, search-builder
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2024-01-18. Score: 4
  
  Can you do import with update flag and on preview screen you can add contacts to group.
  
  [![enter image description here](https://i.sstatic.net/Llgwt.png)](https://i.sstatic.net/Llgwt.png)
  
  or using URL you can do /civicrm/task/add-to-group?reset=1&cids=119,122,137
  
  > **Comments:**
  > **username_0**: That'd work, yep. I'd like something for regular users without import permissions, though. Also it just feels like overkill for what is basically a simple contact ID lookup.  
  > **username_1**: You can do /civicrm/task/add-to-group?reset=1&cids=119,122,137  
  
  ---
  
  ### Answer by username_2 on 2024-01-18. Score: 1
  
  I see in your comment you're looking for something in the UI, but posting this anyway since might be useful.
  
  Assuming your csv only has one column:
  
  `cv ev '$fp = fopen("mycsv.csv", "r"); while (($id = fgets($fp)) !== FALSE) { civicrm_api3("GroupContact", "create", ["contact_id" => trim($id), "group_id" => 4]); } fclose($fp);'`
  
  Replace "4" with the group id.
  
  
  ---
  
  