# Import CSV into Discourse

**URL:** https://meta.discourse.org/t/import-csv-into-discourse/186346
**Category:** Marketplace
**Created:** [April 10, 2021, 8:15pm UTC](https://meta.discourse.org/t/import-csv-into-discourse/186346 "2021-04-10T20:15:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Ali3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ali3/32/161350_2.png) [@Ali3](https://meta.discourse.org/u/Ali3)
#### Post date: [April 10, 2021, 8:15pm UTC](https://meta.discourse.org/t/import-csv-into-discourse/186346/1 "2021-04-10T20:15:46Z")

</div>

What would you like done?  
Hi, I want to import CSV into Discourse as TOPICS, There are a total of 6 CSV, and each CSV having approximately 4000 Rows, or you can say 4000 Topics. Each CSV has 7 columns, which I created just to assign them as Title of the Topic, Topic Category, Tags, and Topic Content.

I am not an expert on this, So all I am looking for someone who can create a script, which I can run and import stuff myself if it’s easy,

When do you need it done?  
I am not sure how much time this all would take, But after researching on Discourse Community Forum, I got so many topics where people mentioned that there are scripts available on Github, and we can use them to import stuff, so if that is the case then I don’t think it will take more than few hours to create a script,

What is your budget, in $ USD that you can offer for this task?  
As it’s a Non-Profit Organization, totally Non Profit, we’re limited on our budget, But still I am happy to pay for your hours, Or if you’re company I will mention about your website, on my website as a Creator, so you can get credit

---

<div class="post-metadata">

### Author: ![honeymoose](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/honeymoose/32/198718_2.png) [@honeymoose](https://meta.discourse.org/u/honeymoose)
#### Post date: [April 11, 2021, 4:32pm UTC](https://meta.discourse.org/t/import-csv-into-discourse/186346/2 "2021-04-11T16:32:14Z")

</div>

I think you can use Discourse API for this.

I did the same for that about 20K topic, can be done in hour.

I was using JAVA Test to make API call, the most important code as below:

```plaintext
        CloseableHttpClient client = HttpClients.createDefault();

        HttpPost httpPost = new HttpPost("https://www.ossez.com/posts.json");
        httpPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/json; charset=UTF-8");
        httpPost.setHeader("Api-Key", "XXXXXX");
        httpPost.setHeader("Api-Username", "XXXXXX");

        TopicRequest topicRequest = new TopicRequest();
        topicRequest.setTitle(bbsOssezForumPost.getSubject());
        topicRequest.setRaw(postCtx);
        topicRequest.setCreated_at(new DateTime(bbsOssezForumPost.getDateline() * 1000L).toString() );
        topicRequest.setCategory(30);

        StringEntity postingString = new StringEntity(new Gson().toJson(topicRequest), StandardCharsets.UTF_8);

        httpPost.setEntity(postingString);

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [May 11, 2021, 4:32pm UTC](https://meta.discourse.org/t/import-csv-into-discourse/186346/3 "2021-05-11T16:32:45Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
