Update: With the release of Tableau Prep 2018.3.3, Wildcard union files are refreshed automatically and the workaround mentioned in this post is no longer required.

If you are using Tableau Prep for long enough, you might have run in to an issue where the new files are not picked up by the wildcard union. This is a known issue and there is an idea submitted by Owen Price to fix this. While waiting for Tableau’s fix, how can we workaround this issue? It turns out that all it take is a two line batch file.

 

Consider a scenario where  sales results are received monthly in its own file.  We want to create a flow that combines all the files automatically for further analysis.

Sales_2018_Jan.csv

First step is to create a flow that uses a dummy input file. Create a copy of  ‘Sales_2018_Jan.csv’ and call it ‘Input.csv’. Create a flow like below that generates ‘Output.csv’ from ‘Input.csv’. I am calling my flow as ‘Wildcard_Workaround.tfl’. Please note that the clean step is empty now, but we need it later.

Now, create a batch script that writes contents of all sales files in to ‘Input.csv’ and execute the flow.

type Sales*.csv>Input.csv
call  "C:\Program Files\Tableau\Tableau Prep 2018.3\scripts\tableau-prep-cli.bat" -t "C:\Automation\Wildcard_Workaround.tfl"

Add sales data for 2 months in to the folder and run the bat file, you will see that your output contains data for the second month as well, but the headers are included in data.

We can fix this by adding  a filter to exclude the string ‘Category’ from Category Field.

Exclude Headers from Data

Now save the flow and add as many sales files as you want in to the folder. Run the bat file and  your output will contain all the data.

If your files are not text based like Excel files, The solution is a bit more tricky. But you can create the flow with dummy file names and then rename your actual files using a bat file to match those in the flow.

 

Leave a Reply

Your email address will not be published. Required fields are marked *