I need to store nearly a #million contact details in my collection for every customer for marketing purpose. So i will ask the user to upload the contacts using a .csv or Excel format. I need to store and retrieve these contacts batch-wise. Can anyone help me out with this?
2 Answers
Use the Database Migration Tool. It has the capability to convert the CSV to JSON file and upload it.

- 535
- 6
- 8
-
Thank you for the suggestion. In my use case I needed to automate that process without having human. So I was asking. – Kartik Apr 05 '18 at 03:54
If it is ok to do this manually for each Customer I would go with Aravinths Answer. If you have to program this I think the best would be to get a good excel-component and read out the adta and insert into CosmosDB, but look out for 429 exception and if you receive that you catch a documentclientException that have a RetryAfter property, so you can do a Task.Delay(ex.RetryAfter) to make sure that you dont throttle the collection to much. Youc could even slow it down more with paging and continuationtoken if you never want to go above 50% of provisioned RU. In the CosmosDB there is also a bulkimport Storedprocedure that you can use, it is in the js folder under serversidescripts here: https://github.com/Azure/azure-documentdb-dotnet/tree/master/samples/code-samples

- 126
- 1
- 2
-
Thanks for reply. I worked out the solution next day itself. Azure gives you a continuation token through which you can continue the request until its complete. It took about an hour to save the payload to db. Thanks again. – Kartik Apr 05 '18 at 03:52