As of version 2018.3, Tableau Prep’s output file name field is static and this will cause the output data to be overwritten  when rerunning the flow.  We can fix this by creating a bat file with following content.

@echo off
for /f %%i in ('powershell -command "$(get-date -f yyyyMMdd_HHmmss)"') do set file_name=Output_%%i.csv
call  "C:\Program Files\Tableau\Tableau Prep 2018.3\scripts\tableau-prep-cli.bat" -t "C:\Automation\sample.tfl"
ren Output.csv %file_name%

 

Explanation:

  • Line 2: A simple batch trick to generate our file_name variable.  You can adjust this line to fine tune your file name.
  • Line 3 : Run the actual flow from command line.  Please refer to the documentation if you need more details.
  • Line 4: Rename the Output file name with our file_name variable. 

Save the bat file and double click on it. The bat file will run and output file will be created according to the timestamp.

Running the flow with bat file

Rerunning the bat file will create a new file with the new timestamp.

Leave a Reply

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