I need… to add a date stamp to my filename

Intro

One aim of building data preparation workflows should be to re-use them when refreshed inputs become available. Not every task involves overwriting the original output file with the new data. Having the ability to create unique output file names can help in these situations. A logical attachment to the filename is when the workflow ran to produce that output. This can help with auditing the data and ensure the right data set is used for the analysis you are doing.

The Scenario

You want to append a timestamp on to the filename of the output to show when the output file was created.

The Steps

  1. Input the Orders table of Superstore (similar to other Prepcipes) and add a Clean step by clicking on the greyed out image next to the Input Step. You don’t need to make any changes for this Prepcipe).

2. Click on the ‘+’ to the right of the Clean step to add an Output step

3. In the configuration of the Output step, you can create a .csv file that can be saved in your downloads folder called ‘Orders Output’.

4. You can now select the Parameters icon at the end of the Name of the file. You can select Run date or Run time. Let’s use Run date making the selection of what part of the date you want or full date format. Let’s use a full date and select the format YYYY-MM-DD.

5. Tableau Prep will show you the datestamp format added to the end of the file name. You may want to amend spacing of the file name or the location of the data stamp in the file name by copying and pasting the blue text created. In the image below, I’ve added a space between the file name and the data stamp.

Outcome

When you run the flow, you’ll now see the completion screen will show the .csv file name with the date stamp added of when the flow was completed.

Previous
Previous

I need… a row number

Next
Next

I need… a Moving Average