# Insert data in queue with Bulk add Queue items error

**URL:** <https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589>\
**Category:** Activities\
**Tags:** datatable, question, studio, orchestrator, activities, system\
**Created:** [April 1, 2023, 2:31pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589 "2023-04-01T14:31:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deep\_HML](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/deep_hml/32/263516_2.png) [@Deep\_HML](https://forum.uipath.com/u/Deep_HML)\
**Post date:** [April 1, 2023, 2:31pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/1 "2023-04-01T14:31:05Z")

</div>

Hello ,

I have an issue when trying to upload datatable to queue with Bulk Add Queue items activity , the error msg is “Operation returned an invalid status code ‘BadRequest’”  
I guess the problem is with datatable size it contains +26k rows i had the idea to use for each but i didn’t know how to do it , maybe there is another solution any help please ?

Regards

---

<div class="post-metadata">

**Author:** ![supriya117](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supriya117/32/412736_2.png) [@supriya117](https://forum.uipath.com/u/supriya117)\
**Post date:** [April 1, 2023, 3:05pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/2 "2023-04-01T15:05:02Z")

</div>

Hi @Deep_HML

Check if the datatable column names contain any (.). If the column name contain any dot(.), it will give the same error. Else try add queue item activity in the for each row in datatable activity with different column names.

Regards,  
@supriya117

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [April 1, 2023, 3:07pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/3 "2023-04-01T15:07:25Z")

</div>

@Deep_HML

To confirm…did you try with only onw row of data? …first try with it…it might be that the columns names are not exactly matching or so…check those…

And yes the limit is 15k or so…

We can break the table into rows of 10k and add in 3 loops

So use for loop with `Enumerable.Range(0,Cint(Math.Ceiling(dt.RowCount/10000))).ToArray` and change type argument to integer

And inside loop to get each chunk use `dt.AsEnumerable.Skip(currentitem*10000).Take(10000).CopyToDataTable`

And use the chunkdt to load the queue

Hope this helps

Cheers

---

<div class="post-metadata">

**Author:** ![supermanPunch](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/supermanpunch/32/133652_2.png) [@supermanPunch](https://forum.uipath.com/u/supermanPunch)\
**Post date:** [April 1, 2023, 3:13pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/4 "2023-04-01T15:13:53Z")

</div>

Hi @Deep_HML ,

Maybe also take a look at the below post :

> [@How to upload one Lakh records to Orchestrator Queues using UiPath Studio?](https://forum.uipath.com/t/how-to-upload-one-lakh-records-to-orchestrator-queues-using-uipath-studio/472206/7):
>
> Please note that a maximum of 15000 lines are accepted by the UiPath Orchestrator. If this limit is reached, an error will be thrown. So, count how many lines you have in one of your queue items. Then divide 15000 by the count of your queue item lines. → This will be the limit of your added queue items while using Bulk Add Queue Items activity. Rule of thumb, lower down a little bit the number of added queue items to make sure you are not crossing the 15000 lines. Let us know if this helped. …

---

<div class="post-metadata">

**Author:** ![arjunshenoy](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/arjunshenoy/32/404588_2.png) [@arjunshenoy](https://forum.uipath.com/u/arjunshenoy)\
**Post date:** [April 1, 2023, 3:22pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/5 "2023-04-01T15:22:19Z")

</div>

Hi @Deep_HML

Possible cause of this error could be due to the size of the data table you are trying to upload. If you try to upload each row as a queue item, it will take 7.2 hours even if you assume one row takes one second.

If you are sure that the datatable structure and colums are correct, you can split the table into batches & try uploading each batch. Try this query:

**dt.AsEnumerable().Batch(1000))**

Hope this helps,  
Best Regards.

---

<div class="post-metadata">

**Author:** ![Deep\_HML](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/deep_hml/32/263516_2.png) [@Deep\_HML](https://forum.uipath.com/u/Deep_HML)\
**Post date:** [April 1, 2023, 3:56pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/6 "2023-04-01T15:56:53Z")

</div>

Hello,  
I double checked the columns are all normal and its worked before when data size was less than 15k

---

<div class="post-metadata">

**Author:** ![Deep\_HML](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/deep_hml/32/263516_2.png) [@Deep\_HML](https://forum.uipath.com/u/Deep_HML)\
**Post date:** [April 1, 2023, 3:58pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/7 "2023-04-01T15:58:15Z")

</div>

Hello Anil,

I tried to do the for each but ‘Ceil’ is not declared i don’t know if it a fonction i need to upload or somth ??

Best Regards.

---

<div class="post-metadata">

**Author:** ![Deep\_HML](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/deep_hml/32/263516_2.png) [@Deep\_HML](https://forum.uipath.com/u/Deep_HML)\
**Post date:** [April 1, 2023, 3:59pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/8 "2023-04-01T15:59:48Z")

</div>

Hello @arjunsjenoy,

Yes am sure of the datatable , so i need to do this query inside of a loop ?

Best Regards.

---

<div class="post-metadata">

**Author:** ![arjunshenoy](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/arjunshenoy/32/404588_2.png) [@arjunshenoy](https://forum.uipath.com/u/arjunshenoy)\
**Post date:** [April 1, 2023, 4:02pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/9 "2023-04-01T16:02:51Z")

</div>

@Deep_HML

Yes, inside the for each loop, upload each batch created.

Best Regards.

---

<div class="post-metadata">

**Author:** ![Deep\_HML](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/deep_hml/32/263516_2.png) [@Deep\_HML](https://forum.uipath.com/u/Deep_HML)\
**Post date:** [April 1, 2023, 4:04pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/10 "2023-04-01T16:04:50Z")

</div>

I did try but it seemed wrong the msg said that batch doesnt exists

---

<div class="post-metadata">

**Author:** ![Anil\_G](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anil_g/32/524291_2.png) [@Anil\_G](https://forum.uipath.com/u/Anil_G)\
**Post date:** [April 1, 2023, 4:09pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/11 "2023-04-01T16:09:31Z")

</div>

@Deep_HML

Use math.ceiling in place of ceil

\*\* Replace above as well \*\*

Cheers

---

<div class="post-metadata">

**Author:** ![arjunshenoy](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/arjunshenoy/32/404588_2.png) [@arjunshenoy](https://forum.uipath.com/u/arjunshenoy)\
**Post date:** [April 1, 2023, 4:11pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/12 "2023-04-01T16:11:07Z")

</div>

@Deep_HML

Change the activity TypeArgument to System.Data.Datatable, place a bulk queue upload activity inside the loop & pass item.ToArray()

Hope this helps,  
Best Regards.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [April 4, 2023, 4:11pm UTC](https://forum.uipath.com/t/insert-data-in-queue-with-bulk-add-queue-items-error/531589/13 "2023-04-04T16:11:42Z")

</div>

Closed on April 4, 2023, 4:11pm UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
