Skip to main content

Creating topics from CSV or Excel files

Create Topics from a CSV File · Create Topics from an Excel File

Import ⚡ tab → Topic Creator group

With the Topic Creator tools you can create topics, snippets, or other XML files from a different data sources. This lets you maintain data in, for example, Excel, and then create the topics using a template file.

Set up a template file​

You can set up a template in any valid XML-file, for example, topic files (.htm), snippet files (.flsnp), or even target files (.fltar).

Set up a template that creates one file per line​

  1. Create a new file in Flare.

  2. Open the file in, e.g. Notepad++.

  3. Use the headers from your data file where you want to import the data. For example, if your Excel file has two columns, Title and Description - you could set up a template like this:

<?xml version="1.0" encoding="utf-8"?>
<html>
<body>
<h1>[[Title]]</h1>
<p>[[Description]]</p>
</body>
</html>

Sample CSV data​

Title;Description
Title A;Description A
Title B;Description B

Templates with repeating patterns​

If your data is hierarchical, for example like this,

TitleData AData BData C
Lorem ALorem 1Lorem 2Lorem 3
Lorem ALorem 1.1Lorem 2.1Lorem 3.1
Lorem ALorem 1.2Lorem 2.2Lorem 3.2

, you can set up a template with a repeating pattern, where the headers inside the <div class="repeat" > are repeated while the other headers stay the same. The example would result in two files each containing a table.

<?xml version="1.0" encoding="utf-8"?>
<html>
<body>
<h1><[[Title]]/h2>
<div class="repeat">
<table>
<th>
<td>Data A</td>
<td>Data B</td>
<td>Data C</td>
</th>
<tr>
<td>[[Data A]]</td>
<td>[[Data B]]</td>
<td>[[Data C]]</td>
</tr>
</table>
</div>
</body>
</html>

Templates for other Flare file types (TOCs, variable sets, targets, ...)​

The Topic Creator works with any XML-based Flare file, not just topics and snippets. Because the class attribute used by the repeating pattern above is only valid in XHTML, non-topic templates use a repeat="true" attribute on the repeating element instead. Both markers behave identically, and the marker attribute is removed from the generated output.

For example, this template file, saved as [[Book]].fltoc, creates one TOC per unique Book value, with one entry per row:

<?xml version="1.0" encoding="utf-8"?>
<CatapultToc>
<TocEntry Title="[[Book]]">
<TocEntry repeat="true" Title="[[Title]]" Link="/Content/[[Title]].htm" />
</TocEntry>
</CatapultToc>

And this template, saved as Variables.flvar, creates a variable set with one variable per row:

<?xml version="1.0" encoding="utf-8"?>
<CatapultVariableSet>
<Variable Name="[[Name]]" repeat="true">[[Value]]</Variable>
</CatapultVariableSet>

The template picker in both Data Import dialogs offers Flare files (.fl) and All files filters in addition to topics and snippets.

Note on output locations: project files do not belong under Content (for example, targets belong in Project\Targets and TOCs in Project\TOCs). Point the output folder at the right project subfolder — and when using a CSV-linked template (the Generate topics from CSV command), keep the template file in the folder where the generated files belong, because the output is written next to the template.

How output files are named​

The name of each generated file comes from the template's file name: every [[Column]] placeholder in the template file name is replaced with that row's value. For example, a template named [[Title]].htm produces Title A.htm for a row whose Title column contains "Title A".

Duplicate file names get a numeric suffix​

If two or more rows produce the same file name, the first occurrence keeps the plain name and every later occurrence gets a numeric suffix: Topic.htm, Topic_1.htm, Topic_2.htm, and so on. File names that are already unique are never renamed. File-name comparison is case-insensitive (like the Windows file system), and a suffixed name never overwrites another name from your data (if your data contains both "Topic" twice and "Topic_1", the second "Topic" becomes Topic_2.htm).

Before anything is written, the import shows the list of duplicate names so you can cancel, fix the data, and run the import again. When running headlessly (KaizenCommander or an import profile), the list is printed to the console and the import proceeds.

Extracting images embedded in Excel (Data Import Excel only)​

If your spreadsheet contains pictures embedded in the rows (for example product photos), select Extract embedded images in the Data Import (Excel) dialog. The import then:

  1. Extracts every picture that is anchored to a data row of the selected sheet (.xlsx only - the legacy binary .xls format is not supported for image extraction).
  2. Saves the pictures to the image folder you pick (leave it empty to use <output folder>\Images) with deterministic names: <dataFileName>_<row>_<n>.<ext>, so re-imports produce the same file names. Existing images are only replaced when Overwrite files is checked.
  3. Adds virtual Image columns to the data: use [[Image]] in your template where the row's picture belongs (and [[Image2]], [[Image3]], ... when rows carry several pictures). The token is replaced with an <img src="..." /> element whose path is relative to the generated file's folder - the per-row folder column is taken into account. Rows without a picture simply lose the token.

Supported formats are the web-friendly ones stored by Excel (PNG, JPEG, GIF); EMF/WMF pictures are converted to PNG where possible, otherwise skipped with a warning. Pictures that float freely (not anchored to a row) or sit on the header row are skipped with a warning. The setting is stored in import profiles, so headless runs (KaizenCommander) extract images too.

Import data from a CSV file​

Note that the CSV file must have a header row.

  1. Click Data Import (CSV).
  2. Select the path to the CSV file.
  3. Select the path to the template file.
  4. Select the folder where you want the output files.
  5. To overwrite any existing files, select the Overwrite files checkbox.
  6. To generate the files, click Execute.

Sample CSV data​

Title;Description Title A;Description A Title B;Description B

Import data from an Excel file​

Note that the Excel file must have a header row.

  1. Click Data Import (Excel).
  2. Select the path to the Excel file.
  3. Select the path to the template file.
  4. Select the folder where you want the output files.
  5. To overwrite any existing files, select the Overwrite files checkbox.
  6. To generate the files, click Execute.

Command line (KaizenCommander)​

Mass imports can run headlessly with KaizenCommander, without Flare open — useful for large batches (thousands of topics), where Flare would otherwise struggle to keep up with the mass of new files appearing in the project:

KaizenCommander -di -import "C:\...\template.htm" "C:\...\data.xlsx" "C:\...\output-folder" [-sheet N] [-overwrite] [-folder "ColumnName"] [-toc "C:\...\file.fltoc" [-append]]

-topics -create is an alias for -di -import, with the same arguments.

  • The data file can be an Excel workbook (.xlsx/.xls), a CSV file, or a JSON file — the reader is picked by file extension.
  • The template file's name doubles as the file name pattern: a template named [[Title]].htm produces one file per unique Title value.
  • -sheet N selects the Excel sheet (default: the first sheet).
  • Without -overwrite, existing files are skipped.
  • -folder "ColumnName" writes each row's file into the sub-folder named by that column's value.
  • -toc builds a Flare TOC from the generated files (-append adds to an existing TOC instead of replacing it).
  • Progress is printed to the console; duplicate file names are reported and numbered automatically. The exit code is 0 on success and -1 on errors.

Saved import profiles (created with Save profile in the Data Import dialogs) can also be run headlessly:

KaizenCommander -di -profile "C:\...\import.flimpk"
KaizenCommander -di -all "C:\...\profile-folder"

The command requires a valid Kaizen Plugin license. Since KaizenCommander runs as its own 64-bit process, very large imports also avoid Flare's memory limits.