Import csv

Hi, I am new and want to setup my project on DatoCMS. I like the product but struggle to import a simple set (no relations) of data which I have in a csv File. Your site says :" As a DatoCMS developer you often find yourself in need of importing data from an external source … An external datasource can be…
a text file with comma separated values (CSV).

However, I can’t find any documentation which explains in more detail how this works. It only goes through an example how it works with an API as data source. Can anyone help? Thansk

Hello @christoph!

Are you talking about this page: https://www.datocms.com/docs/import-and-export/importing-data, right?

In that page we made an example with fetching data from an external API and then import it into DatoCMS. We did not write an example for every use case, because it really depends on your preferred language and libraries, but the core concept is always the same: you read your data from your source and then you use our JavaScript, or Ruby, client to create items.

Talking about CSV, if you want to use JavaScript you can choose one of these libraries to parse CSV files ( https://www.npmjs.com/search?q=csv&ranking=popularity ). If you want to use Ruby, instead, CSV parsing functionality is already present in the core language.

Once you have parsed the CSV file, you can continue to read the guide starting from “Step 2”

Hope this helps!

Thanks- that helps!

1 Like