Bulk import using excel

Hello,

when using bulk import the only way is CSV

while the excel file of around 1000 devices is a “Microsoft excel worksheet” and not a line of comma delimited objects. I tried to save it as a CSV file without modifying anything in its content or putting all the values in one line and to separate them using a comma, I did not get an error but I dont see those devices created, any suggestion? It will be hectic to modify the excel file line by line to the required way of providing the format expected by bulk registration

That will not work this way.
The CSV file has to follow a specific pattern of course: Registering devices - Cumulocity documentation

As an Alternative you can use our very usefull Comman Line Interface https://goc8ycli.netlify.app/

Create devices from template with an Identity

Step 1 create a file called devices.csv

with that file you define which devices you want to create


devices.csv
serialNumber,type,name,owner,firmware_name,firmware_version,firmware_url,lng,lat,agent_name,agent_version,agent_url,hardware_model,hardware_revision,hardware_serialNumber
47113521,c8y_EdgeAgent,device_KAI_created_via_cli1,kai.reinhardt@cumulocity.com,raspberrypi-bootloader,'2.2.0',31aab9856861b1a587e2094690c2f6e272712cb1,11.5820,48.1351
47113524,c8y_EdgeAgent,device_KAI_created_via_cli4,kai.reinhardt@cumulocity.com,raspberrypi-bootloader,'2.2.0',31aab9856861b1a587e2094690c2f6e272712cb1,11.5820,49.1351

Step 2 Define and create the devices using goc8ycli

c8y util repeatcsv devices.csv | c8y devices create --template "{serialNumber: input.value.serialNumber,type: input.value.type,name: input.value.name,owner: input.value.owner,c8y_Firmware: {name: input.value.firmware_name,firmware_version:input.value.version,url:input.value.firmware_url},}" | c8y identity create --template "{ externalId: input.value.serialNumber }"

after solving the previous problem I am facing a new one: same CSV file and same password, sometimes it is working and sometimes not:

"failureReason": "Error during password validation."

any idea why this weird behavior is occurring? should we avoid any characters in the password?
    }

it seems so far that during my test, I am creating the device (thats when the CSV is working) then deleting it and then trying to re-create the same device ID (thats when the CSV is giving the password validation failure), it seems that when deleting the device it is still hanging somewhere and preventing the next push

also we need to push the group assignment in the same bulk import, how could we do that?

Hi bdm
have you deleted the device credentials Managing device data - Cumulocity documentation as well?

Moving the registered devices into a particular groups is also possible if you follow this link

or as alternative you can use https://goc8ycli.netlify.app/

Register a new device into a certain group


c8y devicegroups list -p 1 | c8y api POST /devicecontrol/newDeviceRequests --template '{id: "foo", groupId:input.value.id, type: "mytype"}'

Hi, can I add the device to a specific group in the same CSV where I create this device using bulk device registration? and what is the field I should add to define to which group this device belongs?

Hi @bdm

have you taken a look into that? Have you ever used go-c8y-cli ..... 2.0

I have described in detail I believe would you are looking for.