XML merge function

Hi, is it possible to merge 2 XML files (with same structure) to 1 XML file?
Typicaly 2 XML feed for Google Merchant into 1 XML file.
Thanks

If the XML files are collections of XML items that need to be concatenated in one of the files, you can do it as follows:

  1. Read both files using the “Import plain text” action. Load the entire file content into one cell.
  2. Extract the collection from one file using the xmlvalue() function with XML path such as feed/review.
  3. Insert the collection into the other file by replacing the collection’s closing XML tag with the extracted items + the closing tag using the replace() function.
  4. Export the result into a new XML file using the “Export as plain text” action.

See an example below. In the example, I use the same XML file for concatenating it to itself, but the workflow is the same.

concatenate-xml.zip (2.2 KB)

Remarks:

  • Instead of xmlvalue() you can use keepbetween() - it will keep XML identation, as in the example
  • For advanced XML transformation there always is the “XSLT” action.