Convert CSV to XML in Alteryx - CNDRO.LLC
2816
post-template-default,single,single-post,postid-2816,single-format-standard,wp-custom-logo,theme-bridge,bridge-core-2.9.4,woocommerce-no-js,tribe-no-js,ehf-template-bridge,ehf-stylesheet-bridge-child,qode-page-transition-enabled,ajax_fade,page_not_loaded,,qode-title-hidden,qode_grid_1300,footer_responsive_adv,hide_top_bar_on_mobile_header,columns-4,qode-child-theme-ver-1.0.0,qode-theme-ver-27.8,qode-theme-bridge,qode_header_in_grid,wpb-js-composer js-comp-ver-6.7.0,vc_responsive,elementor-default,elementor-kit-2634,elementor-page elementor-page-2816

Convert CSV to XML in Alteryx

Extensible Markup Language(XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. XML uses a series of simple tags to describe data and these tags can be created in an easier way.

CSV is a simple file format used to store tabular data such as a database or spreadsheet. A CSV file stores data in a structure that can be read and written by a wide range of several spreadsheet software packages.

In this article, I’ll walk you through how to convert CSV to XML in Alteryx. Let’s get right in.

We will use some tools in Alteryx to achieve our aim.

  • The first tool we will be using in this conversion is the input tool which shows an input file. This is where we will pass in our sample data.
  • The second tool is the Record ID which will be used to number the data sequentially. We can call this an index.
  • The third tool is the Transpose which we will use to change the data orientation from vertical to horizontal.
Here is the result of this phase:

 

Add regex to remove spaces in the Name column using the Formula tool. After then, use the select tool to pick the fields and rename the datatype from string to integer.

We will use the formula tool again to perform two different calculations for the name tag. Afterward, add both name tags and re-index using the Record ID tool.

Use the text input tool to add xml initiation line such as this; <?xml version=”1.0″ encoding=”UTF-8″?>,and it will be passed to the data. The union tool will then be parsed in to connect different data coming from the workflow.

The summation tool coming from the Record ID tool will be used to group the data using the name column.

 

 

 

The Append Field tool as shown below will be used to append some of the fields i.e. ColumnNumber to each of the fields(XmlLine, RecordId, Level). The other tools used include the Multi-Row Formula tool, the formula tool, and then parsing the join, union tool and summarizing them to obtain our XML file.

 

 

 

We’ll then use the output tool in viewing our results.

 

No Comments

Post A Comment