Hi there, anyone already done a CVS import to pre-populate a collection? Thanks in advance
#1031993785971900556Hello
@1029713634466734170- I've heard of people doing this, there may even be a code example in the discord archive
However, you could create a script to loop over each entry in your CSV and hit the create endpoint for that collection
You could also do it via a migration script in mongodb, but the API route feels easier to me
Thanks
@1049775120559898725- do you think it would be a good use case for a plugin?
@Ab
It could be if enough people are importing a lot of data!
Here's an example script doing an import from csv
https://payloadcms.com/community-help/github/user-csv-import-for-a-collectionThanks a lot Elliot - I actually ended up writing a complete DB seed script using Payload in 'local' mode - really handy feature 👍
Just a word of warning for anyone who ends up here, there's some divergence between data operations between dashboard and local API and this can lead to some pretty difficult to diagnose bugs on programmatic data interactions - two discussions in GH:
https://github.com/payloadcms/payload/discussions/2889and
https://github.com/payloadcms/payload/discussions/2785@967118574445547650
I am using
next-payloadand want to give user the option to upload bulk data in a collection, how can I achieve that..?
This option won't work for me, I need to do it using hooks or something, any help about that..?
Hello, am looking for this functionality in 2026 as non technical ppl is interested in using the dashboard to bulk load csv and export backups.
I'd have to say, looping thru the csv and load items 1 by 1 via REST or payload local API is VERY slow.
5000 rows can take you 1 to 2 hours.
You can build your own functionality within the application code, like concurrently in batches of 1000 etc, but its a lot of hassle, when you need to deal with things like exhausting connection pools, load interruptions due to connection issues, etc.
If you have access to the db connection strings, I'd recommend using an external db management tool like dbeaver instead to do these kinds of db things, like import and export csv, backups etc.
FYI, instead of using Payload's local/REST API try using Drizzle. If your CSV shape is at least consistent and you don't need a full mapping UI then this will work. Building a custom UI is the other option with column mappings if the shape might be dynamic.
Star
Discord
online
Get dedicated engineering support directly from the Payload team.