Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Help for labelling each data with its sheet name

Eug_teng
7 - Meteor

I have an excel file with multiple sheets (Same format) and would like to label each record with the originating sheet name / number when I import all of them together. How do I go about doing this?

 

E.g Sheet 1

 

CodeNumber
a123
b234
c345

 

E.g Sheet 2

 

CodeNumber
e456
f567
g678

 

E.g Output

 

CodeNumberSheetname
a1231
b2341
c3451
e4562
f5672
g6782

 

Thank you!

6 REPLIES 6
anjaliaithal
7 - Meteor

1) Make sure you have chosen 'Full Path' in Output File Name as field

 

anjaliaithal_0-1605778843016.png

 

Your output will have a column with full Path like 'Folder\Filename.xlsx||||`Sheet1$`

anjaliaithal_0-1605785032401.png

 

 

2) After Union of two sheets, add a Text to columns with the following config:

anjaliaithal_1-1605779324387.png

One of your output columns is like this

anjaliaithal_2-1605779360462.png

3) At the end, add a data cleansing tool

anjaliaithal_3-1605779437868.png

 

PhilippK
Alteryx Alumni (Retired)

Hi @Eug_teng ,

 

you can use a FORMULA tool to add a new "Sheetname" column (see attached).

 

Or you do it dynamically, e.g. by importing the list of sheet names first:

screenshot.png

 

Best 

Phil

Eug_teng
7 - Meteor

Hi Phil,

 

Thanks for the suggestion!

 

But what if all the sheets are in 1 excel file and I want to use only 1 input tool?

Eug_teng
7 - Meteor

Hi anjaliaithal,

 

Thanks for the suggestion!

 

But what if all the sheets are in 1 excel file and I want to use only 1 input tool?

anjaliaithal
7 - Meteor

First Part of Workflow

 

anjaliaithal_2-1605784318785.png

 

1) Input Tool Config

anjaliaithal_0-1605784161655.png

Output

anjaliaithal_1-1605784282109.png

2) Formula For new File Name

anjaliaithal_0-1605785461116.png

 

Output

anjaliaithal_0-1605784916198.png

 

3) Dynamic Input Tool Config

      a)In the Input DataSource Template, click 'Edit'. Choose Sheet1 (You can choose Sheet 2 also)

             Make sure you choose 'File Path' in the highlighted section. Click on OK

anjaliaithal_6-1605784551921.png

      b) Complete the config as below

anjaliaithal_7-1605784624885.png

Output

anjaliaithal_8-1605784736082.png

Second Part: Please lookup to my first answer of  using text to columns and DataCleansing

 

 

Eug_teng
7 - Meteor

Thank you! This works:)

Labels