Creating Multiple Sample XML Documents from an Excel Spreadsheet with Liquid Data Mapper

This article shows you how to generate multiple XML documents, one for each row in an Excel spreadsheet, using Liquid Data Mapper.


We recently received a support ticket where the user wanted to generate a sample XML document for each row within an Excel spreadsheet.

This is easy to achieve using Liquid Data Mapper.

Here is our Spreadsheet data:

Creating Multiple Sample XML Documents from an Excel Spreadsheet with Liquid Data Mapper

And here is a simple Data Mapping to create an XML document from the Excel data:

Creating Multiple Sample XML Documents from an Excel Spreadsheet with Liquid Data Mapper

However, this will create a single XML document containing all rows from the Excel spreadsheet. In order to output multiple XML documents, i.e. one per row, we need to make a few simple changes:

  1. Right click on the Xml Writer and select ‘Toggle Simple View’ to show the Filename node.
  2. Connect the Excel Reader ‘Row’ node to the Xml Writer ‘bookstore’ node.
  3. Add a ‘Concat’ component and a ‘Const’ component.
  4. Set the type of the ‘Const’ to be a string and the value to be .xml.
  5. Connect the ‘Title’ node to the String 1 of the Concat.
  6. Connect the ‘Const’ to the String 2 of the Concat.
  7. Connect the Concat to the Filename node.

 Creating Multiple Sample XML Documents from an Excel Spreadsheet with Liquid Data Mapper

When we run the updated transform, we now see three XML documents are generated ‘The Graveyard Book.xml’, ‘The Portable Door.xml’ and ‘XML Schemas.xml’. Each XML document contains the Row data specific to the book.

Further Reading

Please see the data mapper documentation for additional information about transforming Excel to XML in Liquid Data Mapper.

Download a Free Trial of Liquid Data Mapper:
https://www.liquid-technologies.com/trial-download

 

Discover more from Liquid Technologies Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading