Resolve duplicate column names in excel file with Alteryx
- How-Tos FAQs
- March 16, 2021
Let’s explore how to resolve duplicate column names in an excel file with Alteryx. As we work with databases it is common, especially if we work on Microsoft Excel, to have different columns with the same name.
Alteryx, differently from Excel, does not allow different fields in the same dataset to have the same name. Otherwise, Alteryx will not be able to understand which of the two fields we want to process through the workflow.
For this reason, Alteryx will automatically rename any column in the dataset that has the same name of a previous field (reading from left to right) adding a counter digit at the end of the field name as shown below.
Of course, any duplicated field names and automatic rename will be noticed in the log as a warning message as shown below.
Obviously, this kind of differentiation through automatic rename it is not very helpful to keep fields user-readable, but we have a very simply way to handle this situation.
- We can use a Select tool to manually rename any single field we need
The starting database should appear as shown below
The aim is to have a database made up of different field (‘ID’, ’Height’, ‘Width’, ‘Thickness’, ‘Weight’,) with no duplicated field names
- Connect a Select tool directly to your workflow
- In the configuration, panel rename any field you want with the correct name
The ending database should appear as shown below
As you can see the fields have been correctly renamed.
We have seen how to handle with duplicated field names using a simple Select tool to rename those.
Renaming is not the only one activity available through Select tool, it useful if we want to
- Drop unnecessary fields
If you want to drop a field, just unflag it as shown below
Here we have dropped Height and Width fields
- Change fields data type
If you want to change the data type of a specific field, just select from the menu the desired datatype on the row corresponding to that field
Here we have edit data type of ‘Thickness’ field to ‘Double’
- Edit field size
If you want to increase or decrease the maximum size allowed in a specific field, just type the decided maximum size on the row corresponding to that field
Here we have increased ID’s field size from 254 to 300 allowed characters
- Add a description to any field
If you want to add a text description to a specific field, just type the description on the row corresponding to that field
Here we have added a description to the field ‘Wight’
The description will be stored in the database’s metadata available in the ‘Result’ panel through the button on the right ‘Data/Metadata’
As you have certainly noted, any change made through a Select tool will be highlighted in red in its Configuration panel.
And that’s how to tesolve duplicate column names in excel file with Alteryx.
Check out: How to create a date combining different fields in Alteryx