Import a Text File

Confluence allows you to import text files from a directory on the Confluence server, and convert them into Confluence pages. Each file is imported as a separate Confluence page with the same name as the file.

  • The text file may contain plain text, HTML or Confluence storage format
  • You need to be part of the confluence-administrators group or a System Administrator to import text files
  • You can import pages from disk into site spaces, but not into personal spaces
    Please see Spaces for information about differences between site spaces and personal spaces.

To make sure Confluence maintains the formatting of the text document, add <pre> to the beginning and </pre> to the end. This will let Confluence know that it should treat the text as pre-formatted.

If you're working in a Unix-like environment, you can add the opening and closing tags to all files in a particular directory by following these steps:

  1. Go to the directory containing the files
  2. Run the following command in the terminal:

    for i in $(ls); do echo "<pre>" >> m$i; cat $i >> m$i; echo "</pre>" >> m$i; mv m$i $i; done

To import text files:

  1. Go to the space and select Space tools > Content Tools from the bottom of the sidebar
  2. Choose Import.
  3. Type the directory path into the Import directory box.
  4. Select Trim file extensions to remove file extensions from the page titles when converting the files to Confluence pages
    The Confluence pages will take their titles from the files' names (including their extensions). To avoid having page titles with a suffix like '.txt' check this box.
  5. Select Overwrite existing pages if you want to replace existing Confluence pages with the same title with the one you're importing.
  6. Choose Import.

Screenshot: Importing text files

Last modified on Feb 21, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.