# Automatic Labeling Upon Import in Label Studio using a CSV File

**URL:** <https://community.labelstud.io/t/automatic-labeling-upon-import-in-label-studio-using-a-csv-file/204>\
**Category:** Label Studio Support\
**Tags:** annotations, csv\
**Created:** [May 21, 2024, 7:54pm UTC](https://community.labelstud.io/t/automatic-labeling-upon-import-in-label-studio-using-a-csv-file/204 "2024-05-21T19:54:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sajarin](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/sajarin/32/56_2.png) [@sajarin](https://community.labelstud.io/u/sajarin)\
**Post date:** [May 21, 2024, 7:54pm UTC](https://community.labelstud.io/t/automatic-labeling-upon-import-in-label-studio-using-a-csv-file/204/1 "2024-05-21T19:54:23Z")

</div>

#### Question:

> I have a CSV file of image URLs and their classification labels. I am trying to figure out how to construct the CSV so that the images are automatically labelled when imported.  
> Apologies for the basic question but I couldn’t find this in the docs. Is this possible?  
> For Label Studio to use the CSV data for pre-annotations, you need to format your CSV to match your labeling configuration.

### Answer:

For Label Studio to use the CSV data for pre-annotations, you need to format your CSV to match your labeling configuration.

#### CSV Format:

1. **Image URL Column** : A column for the image URLs.
2. **Label Column** : A column for the classification labels. These should be in a format that corresponds to your label configurations.

Your CSV should look similar to this:

```auto
image_url,category
http://example.com/image1.jpg,Cat
http://example.com/image2.jpg,Dog

```

#### Importing into Label Studio:

When importing this CSV:

- Use the **Label Studio UI** to select your CSV file and align the column names with the respective fields in your project’s labeling configuration.
- If using **Label Studio SDK** , you might use a command resembling this:

```auto
project.import_tasks('path/to/your/csvfile.csv', preannotated_from_fields=['category'])

```

Please ensure that the `category` field in your CSV aligns with the `from_name` attribute specified in your labeling configuration within Label Studio.

The above is just an example, you’d have to modify the CSV headers accordingly for your specific data.
