Alteryx Designer Desktop Discussions

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

Import multiple excel file with specific sheet and labelling each sheet by month

JingYih_Herbalife
8 - Asteroid

Hi,

 

I have inventory forecast and accuracy data for each month. The file names are labelled as such

 

JingYih_Herbalife_0-1658066203655.png

Each file has multiple sheets, but I only require the data from the sheets with name "Accuracy"

 

JingYih_Herbalife_2-1658066283510.png

 

Since each excel file is for a separate month, I want to label the data by month.

 

Which tool should I use for this? An example of the tools configuration and flow would help greatly.

 

Thanks and regards,

Jing Yih

 

 

 

8 REPLIES 8
IraWatt
17 - Castor
17 - Castor

Hey @JingYih_Herbalife,

Here's two way to do this:

Way One:

IraWatt_3-1658067507895.png

 

Usining a input data tool you can add a '*' asterisk. The asterisk acts as a wild card, the asterisk wild card means any number of characters. The import data tool will import any file which matches the pattern of the starting and ending text plus the asterisk which can be any text. The pattern shown above should collect all the data from your files.

 

Way Two

 

 

IraWatt_0-1658066984038.png

Start with a directory tool and configure it too look at the folder containing all your Excel Sheets.

IraWatt_1-1658067035735.png

As we just want the Accuracy sheets add the sheet name to the file path as shown above with ||| before the name using a formula tool.

IraWatt_2-1658067095161.png

Finally using the dynamic input tool you can pull all the files at once. First configure it by selecting one of the Excel files as a template then select the field full path and change the entire file path option.

 

You may need one or two extra steps if the columns differ between the files but this is the standard way I would do this.

 

Any questions or issues please ask :)
HTH!
Ira

 

 

 

JingYih_Herbalife
8 - Asteroid

Hi @IraWatt ,

 

The solution doesn't work. Is it because for each file, the "Accuracy" tab name is show different because of the date behind? Also how do I go about labelling each of the data import by month?

 

JingYih_Herbalife_0-1658068331904.png

JingYih_Herbalife_1-1658068348986.png

 

IraWatt
17 - Castor
17 - Castor

@JingYih_Herbalife that's alright using method two you can add the extra sheet details into the formula tool like this:

IraWatt_0-1658068765438.png

 

JingYih_Herbalife
8 - Asteroid

@IraWatt is my configuration correct for the dymamic input tool? I am getting an error as per below.

 

JingYih_Herbalife_0-1658070543184.png

 

IraWatt
17 - Castor
17 - Castor

@JingYih_Herbalife it looks like you have put back slashes for the sheet information eg. "\\\accuracy" it should be pipes like this: "|||accuracy". Update your formula to this:

[FullPath]+"|||Accuracy"+left(Right([FileName],14),6)
JingYih_Herbalife
8 - Asteroid

Alright that works. 

 

Do you know why some of the files are not read? 

JingYih_Herbalife_0-1658072298322.png

 

And also based on the browser, the data shown does not identify the data are coming from which month. How do I sort this?

 

IraWatt
17 - Castor
17 - Castor

Nice now you have the file paths sorted. The dynamic Input tool skips files when the schemas between the files are different eg(different number of columns, different field data types, ect...). You can compare each files fields using the field info tool:

IraWatt_0-1658073760346.png

This will tell you which column Names or Type is different.

 

To solve this easily you can ether use my macro on the gallery: Dynamic Input Allow Different Fields Tool - Alteryx Community 

IraWatt_1-1658073904882.png

 

Or you can make your own Macro to loop though and import each file 

IraWatt_2-1658073934755.png

A macro will let you decide how the data is combined as you import it:

IraWatt_3-1658074002501.png

There are some great videos on the community explain how you can automate things with macros here: Interactive Lessons - Alteryx Community

 

 

jboyette
5 - Atom

Ira,

 

Will your Dynamic Input Allow Different Fields tool output the filename?  I am currently using the standard Input tool, which has an option to output the filenames as a field.  From this, I'm parsing to get a date that is embedded in the filename.  The problem I have with the standard Input is that, when I'm using the * wildcard to input multiple Excel files from the same directory, one of them has a column set to V_Wstring instead of V_string, which throws off the input and doesn't import that file.  

I thought I could use this tool, but I can't seem to find out if it can output the filenames of the files.

 

Jason

Labels