# CSV Import

## Information

With Datacake, you can easily import LoRaWAN devices through a .CSV file. Just drag and drop the file into the designated upload area outlined in step 3, labeled "Device".

<figure><img src="https://2221155863-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LNA8_b8wmabHgJ0QXoJ%2Fuploads%2FIJfq0dvCjX2XeHxcbR3U%2FBildschirm%C2%ADfoto%202023-05-05%20um%2011.55.08.png?alt=media&#x26;token=c2406e71-47ad-4ff7-8539-909b3d394de7" alt=""><figcaption><p>Step 3 - Add Devices manually or via CSV-File</p></figcaption></figure>

## Structure

To ensure proper formatting, the .CSV file must adhere to the following row structure.

`DevEUI;Device Name;Device Location description;Tag 1,Tag 2,Tag 3`

If you only wish to share the DevEUI and Device Name, it's not necessary to include the Device Location and Tags.

`DevEUI;Device Name;;Tag 1,Tag 2,Tag 3`

`DevEUI;Device Name;Device Location;`

`DevEUI;Device Name;;`

### File Example

Please ensure that your .CSV file is structured exactly the same as the provided example.

```csv
123456789abcdef1;Device 1;Room 101;Temperature,Humidity,Pressure
aabbccddeeff1122;Device 2;Room 202;Light,Occupancy,Safety
f0e1d2c3b4a59687;Device 3;Room 303;CO2,Smoke,Fire
0123456789abcdef;Device 4;Room 404;Noise,Vibration,Shock
fedcba9876543210;Device 5;Room 505;Water,Level,Flow
```

{% hint style="danger" %}
Avoid using a header on the first line of the CSV. This can cause confusion for the importer.
{% endhint %}

#### Template File

{% file src="<https://2221155863-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LNA8_b8wmabHgJ0QXoJ%2Fuploads%2FEkQ0eWZtKELCRgwtlmbU%2Flora_devices.csv?alt=media&token=e219feaa-7b01-477a-9932-96ea7f705531>" %}
Example CSV-File as Template
{% endfile %}

### Tags

To attach tags to your devices, simply include them in the 4th column of the CSV file.

```
123456789abcdef1;Device 1;Room 101;Temperature
```

{% hint style="danger" %}
Please remember to separate multiple tags with a comma.
{% endhint %}

```
123456789abcdef1;Device 1;Room 101;Temperature,Humidity,Pressure
```

## Datacake LNS

You can also batch import devices to the Datacake LNS. For that you will have to drag and drop a file with the following structure:

`DevEUI;Device Name; AppEUI(or JoinEUI); AppKey/NWKKEY; Frequency; Device Class; Location description;Tag 1,Tag 2,Tag 3`

{% hint style="info" %}
Make sure that your CSV file doesn't have a header with the titles (it should simply start with the first device). Otherwise the platform will return an Error message.&#x20;
{% endhint %}

If you  want, you don't need to include the Device Location and/or Tags. The structure is then the following:

`DevEUI;Device Name; AppEUI(or JoinEUI); AppKey/NWKKEY; Frequency; Device Class;;Tag 1,Tag 2,Tag 3`

`DevEUI;Device Name; AppEUI(or JoinEUI); AppKey/NWKKEY; Frequency; Device Class; Location description;`

`DevEUI;Device Name; AppEUI(or JoinEUI); AppKey/NWKKEY; Frequency; Device Class;;`

We  currently support the following frequencies:

* `EU_863_870_TTN`
* `US_902_928_FSB_2`

And the devices classes:

* `A`
* `C`

Remember that DevEUI and AppEUI are strings 8 bytes long. AppKey is a 12 byte string. All of them should be provided by your device manufacturer.&#x20;

```
4954957556556566;Device 1;cd1a75ae5818dcbe;c39ebd8578c3d7ac6dfef73afb60dfba;EU_863_870_TTN;A;Room 101;Temperature,Humidity,Pressure
aabbccddeeff1122;Device 2;cd1a75ae5818dcbe;f171b14be6e3494ce6da3dd8e67cbb8c;EU_863_870_TTN;A;Room 202;Light,Occupancy,Safety
```

Template file for the Datacake LNS auto-importer:&#x20;

{% file src="<https://2221155863-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LNA8_b8wmabHgJ0QXoJ%2Fuploads%2Ffpfx6dOIlKzRKsxCaMvy%2Fdevice_data_datacakelns.csv?alt=media&token=a8dcb731-ea3a-4945-a72e-9b9e75c775c8>" %}
