How To Export Confluence Questions Content to CSV Through the Database
プラットフォームについて: サーバーと Data Center のみ。この記事は、サーバーおよび Data Center プラットフォームのアトラシアン製品にのみ適用されます。
This guide is for informational purposes and is not eligible for support as part of the Atlassian Support Offerings. If you have any questions about the information on this page, please reach out to our Atlassian Community for help.
This guide will help you exporting the whole content generated in the Confluence Questions plugin to a CSV file by running a query against the application's database.
This process requires the use of direct database manipulation and is not part of Confluence's intended functionality. As such, this process is not covered under the Atlassian Support Offerings and the information on this page is provided as-is. It should be thoroughly tested in a development or staging environment before implementing any changes in your production instance.
This query was written to be used in PostgreSQL. If you're using another DBMS, it might be necessary to adjust the query to use the specific functions of your DBMS.
COPY (SELECT c.contentid AS "ID", c.parentccid AS "Parent_id", (CASE WHEN c.pluginkey = 'com.atlassian.confluence.plugins.confluence-questions:question' THEN 'QUESTION' WHEN c.pluginkey = 'com.atlassian.confluence.plugins.confluence-questions:answer' THEN 'ANSWER' WHEN c.pluginkey = 'com.atlassian.confluence.plugins.confluence-questions:comment' THEN 'COMMENT' END) AS "Type", c.title AS "Title", bc.body AS "Content" FROM content c INNER JOIN bodycontent bc ON c.contentid = bc.contentid WHERE c.pluginkey IN ('com.atlassian.confluence.plugins.confluence-questions:question', 'com.atlassian.confluence.plugins.confluence-questions:answer', 'com.atlassian.confluence.plugins.confluence-questions:comment') ) TO '/tmp/questions.csv' WITH CSV HEADER DELIMITER ',';
Note that the path at the end of the query is set to /tmp/questions.csv. This will save the file in your /tmp/ directory in a Unix environment, with the file named as questions.csv. If you're using Windows or want to change the path, please update this before running the query.