Importing Data - npruehs/tome-editor GitHub Wiki

In addition to exporting data, Tome allows you to import data from CSV, XSLX or GoogleSheets.

Data Import

Creating Import Templates

Just as with exports, Tome needs to know how to import your data. With import templates, you tell Tome the type of your data source, the column specifying your record IDs, which records to parent newly imported records to, how table columns relate to your Tome fields, and which table rows to ignore, if any.

<?xml version="1.0" encoding="UTF-8"?>
<Template Version="1">
    <Name>Units (XLSX)</Name>
    <SourceType>XLSX</SourceType>
    <IdColumn>ID</IdColumn>
    <RootRecordId>Unit</RootRecordId>
    <ColumnMap>
        <Mapping ColumnName="Attack Damage" FieldId="AttackDamage"/>
    </ColumnMap>
    <IgnoredIds>
        <Id>COMMENT</Id>
    </IgnoredIds>
    <Parameters>
        <Parameter Key="Sheet" Value="Sheet1"/>
    </Parameters>
</Template>

In import templates, you need to add the following XML elements:

  • Name. Name of your import template, as it should appear in the editor.
  • SourceType. Whether you want to import from CSV, XSLX or GoogleSheets.
  • IdColumn. Header of the column of your data source that specifies the ids of the records to import.
  • DisplayNameColumn. Since Tome 1.1. Header of the column of your data source that specifies the display names of the records to import. Will fall back to the record id if not specified.
  • EditorIconFieldIdColumn. Since Tome 1.1. Header of the column of your data source that specifies the editor icon field ids of the records to import.
  • RootRecordId. If your data source contains any record IDs that are not already present in your Tome project, the import will cause new records to be created and automatically parented to the record with this RootRecordId.
  • ColumnMap. May contain an arbitrary number of Mapping children. Each Mapping specifies a ColumnName to map to an existing Tome FieldId. When importing data from your source, Tome will replace all column headers matching any mapping. Note that line breaks in Excel cells will be replaced by an underscore (_) for the import, so your ColumnName should do so as well.
  • StringReplacementMap. Since Tome 1.1. Element with two element children String and ReplaceWith.
  • IgnoredIds. May contain an arbitrary number of Id children. If you want to include comments in your data source, or to skip some records, you may specify which rows to skip here. Tome will ignore any records of your source who have a matching ignored id in their IdColumn (see above).
  • Parameters. XLSX data sources require an additional parameter Sheet, specifying which sheet to import. Other data sources don't need additional parameters.

After having a created an XML file with the above contents, you can save it with the extension timport and add it to your project from the Project Overview window.

If you're experiencing an error message similar to "Source file could not be read: ... [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified. QODBC3: Unable to connect.", then you might be missing the matching database engine. Tome requires the matching database engine for importing Microsoft Excel files. Usually, it should have been installed when you installed Office. If that's not the case, download the Microsoft Access Database Engine 2010 Redistributable . As Tome is currently shipped as 32-bit version, you'll require the 32-bit version of the database engine as well.

Importing Data

After having added the import template to your project file, it will be available from the Import menu:

  1. In the main window menu bar, click Import.
  2. Select the template to import the data with.
  3. Specify an input source.
  4. Observe the import results in the Output window.

Tome will automatically try to convert the imported data to the format corresponding to the type of the respective fields. When importing lists, list items have to be separated by commas.

Importing maps is not supported.

Next: Game Configurations

⚠️ **GitHub.com Fallback** ⚠️