# Is het mogelijk om topic post data te exporteren naar csv?

**URL:** https://meta.discourse.org/t/is-it-possible-to-export-topic-post-data-to-csv/295350
**Category:** Support
**Tags:** data-explorer
**Created:** [14 februari 2024 om 15:19 UTC](https://meta.discourse.org/t/is-it-possible-to-export-topic-post-data-to-csv/295350 "2024-02-14T15:19:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![simon\_tomes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon_tomes/32/457537_2.png) [@simon\_tomes](https://meta.discourse.org/u/simon_tomes)
#### Post date: [14 februari 2024 om 15:19 UTC](https://meta.discourse.org/t/is-it-possible-to-export-topic-post-data-to-csv/295350/1 "2024-02-14T15:19:29Z")

</div>

Is it possible to export topic post data to a csv file?

I’d like to take a topic post and all of it’s replies and turn it into a handy wiki (for example).

I could copy and paste the replies and find a good way to group them. However, if it’s easier to do an export of a topic and all replies I’d welcome the time saver.

If not an option via csv, could this be done via the [data explorer](https://meta.discourse.org/t/32566?silent=true)?

I’d like to see the reply content along with the associated user who replied.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [14 februari 2024 om 15:53 UTC](https://meta.discourse.org/t/is-it-possible-to-export-topic-post-data-to-csv/295350/2 "2024-02-14T15:53:14Z")

</div>

This might help, if not exactly what you ask, raw format:

[https://meta.discourse.org/raw//295350](https://meta.discourse.org/raw//295350)

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [14 februari 2024 om 15:56 UTC](https://meta.discourse.org/t/is-it-possible-to-export-topic-post-data-to-csv/295350/3 "2024-02-14T15:56:59Z")

</div>

Yes, you can export the query result to a CSV file. You have a button for that action:

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/3/c/d3cb4be14d3406163cf39315817fef7b135b812c.png)

I’m not entirely certain if this is precisely what you had in mind, but I can provide you with a starting point. You provide a topic ID and the post number you want to get all replies from:

```SQL
-- [params]
-- integer :topic_id
-- integer :post_number

SELECT u.id,
       u.username,
       p.raw,
       p.cooked
FROM topics t
JOIN posts p ON t.id = p.topic_id
JOIN users u ON p.user_id = u.id
WHERE t.id = :topic_id
  AND p.reply_to_post_number = :post_number
  AND p.hidden_at IS NULL
  AND p.deleted_at IS NULL

```

This looks like this:

 ![image](https://global.discourse-cdn.com/meta/original/4X/0/5/8/058642eb72bceb4c2527ec57a88ed881bec28168.png)

---

<div class="post-metadata">

### Author: ![simon\_tomes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon_tomes/32/457537_2.png) [@simon\_tomes](https://meta.discourse.org/u/simon_tomes)
#### Post date: [14 februari 2024 om 16:01 UTC](https://meta.discourse.org/t/is-it-possible-to-export-topic-post-data-to-csv/295350/4 "2024-02-14T16:01:40Z")

</div>

Thanks for your advice, @merefield and @Arkshine.

I shall explore and give some things a go.
