How to convert HTML pages to Confluence pages using Confluence CLI

This article explains how to convert HTML files to Confluence pages using the Confluence Command Line Interface app. Another possible use case is if you want content from certain HTML files to be available on new Confluence pages in a specific space.


For this scenario, use the runFromCsv and storePage CLI actions to: 

  • runFromCsv: Runs all the actions generated from the CSV file with the mentioned parameters.
  • storePage: Create or update a page.
  1. Create a CSV file with column headers: space, parent, title, and, file. If the file(s) are available at different locations, provide the full path of the HTML file(s) under the file column. 
    For this example, make sure that the required files, including the CSV file, are available in the CLI Client location. Enter the following values in Page.csv

    • Make sure that the HTML content in each file is valid so that the CLI command processes the content correctly.
    • If an HTML file contains any invalid or incomplete HTML tag(s), the CLI stops further process of that file, displays the relevant error(s), and, continues to process the remaining files, if any.
  2. Execute the following CLI command:

    --action runFromCsv --file Page.csv --common "--action storePage --noConvert" --continue

The output of the given example is displayed as follows:

In the sidebar of the screenshot, note that a page is created for each HTML file under a parent page, Confluence CLI, as specified in Page.csv. Click any one of the options from the sidebar to view its content. The content of Page_6, for example, is displayed as:

It is recommended to test the CLI actions in a test environment before deploying in production.