community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.

How To: Save an Excel File with Today's Date

Community Operations Manager
Community Operations Manager
Created on

 

We get quite a few requests asking how to add the current date to Excel spreadsheet file names. The difference in adding information to your file name in Excel and other output configurations is that you have to use the Reporting tools for Excel to accept the new file name.

 

Why would I have to use the Reporting tools, you ask? Simply put, Excel thinks that when you are adding a prefix or suffix to the file name that you are stating that additional information is the “Sheet Name” and not appending the file name from the Output Tool. The Render tool in the Reporting tab on your palette basically tricks Excel into thinking that you are creating a separate report and is able to append the date.

 

In order to add the date to the file name you will connect these tools to your workflow in the order, you see below.

 

Formula.png

 

 In the Formula Tool, create a new field that is a String type.  Go to the DateTime functions and add the DateTimeToday() expression. No configuration of the expression is necessary.

 

Table.png

 

 The Table tool will allow you to Group By this new field.

        • In the GroupBy Configuration, choose the Date field you created in the Formula.
        • In the Per Column Configuration, uncheck the new field. This will allow you to group by the new field name in the Render Tool and still remove it from the data so that your new field does not appear in your report.

 

 

Render.png

 

 

 Use the Render Tool to output your Excel spreadsheet with today’s date in the file name.

 

      1. Output Mode - Choose a Specific Output File.
      2. Output File - Specify the Excel 2007 Spreadsheet (xlsx) and point to where you would like to save the documents. The file name you specify will be replaced with the date in step 5 below.
      3. You will then check the box that says Group Data into Separate Reports.
      4. Field to Group on - You will choose your new field that you created.
      5. Modify Filename By – Replacing Filename With Group.
      6. Report Data – You will choose Table and can leave the rest as defaults.

 

Attachments
Comments
Asteroid

I'm confused. If I choose Temporary Excel 2007 in the Output Mode, it grays out the Output File/Group Data/Field to Group on/Modify Filename By items so I can't make any changes to them. 

 

If I select Choose a Specific File to Output, then I am able to select a file and select the the rest of the options here, and my output file has the correct name, but i get a corruption warning and when the file opens regarding the filetype, and it looks absolutely nothing like the file should. Basically jibberish. 

 

Any Thoughts? 

 

I tried doing this with a formula and the regular output tool, also, but it kept adjusting the name of the Tab, or telling me I needed to have a tab in the file name, and wouldn't replace the entire File Name/Tab Name if I told it to. 

 

Thanks,

Atom

I have somewhat the same issue as FFFool.  I find that it works very will with a small number of columns but table width seems to cause a lot of issues.   Has anyone else come across this?

Creative Director
Creative Director

Thanks, @FFFool and @tmjs! I just updated the article with ammended instructions and an example workflow. 

Meteor

I have tried this procedure to add today's date to the end of an Excel filename but I'm having an issue with the output. I have 43 columns and my column headers are getting truncated. Is there a solution for this?

Asteroid

@lgregor

 

In the render tool, set the paper size to Custom Size, and adjust the width until your data displays properly. Unfortunately, this is the only real way I've found to do this, and it takes some playing around, as if you make it too wide, you will get lot's of empty space in your data.

Fireball

This solution might have been the only option in 2015 if you are looking for a better solution here's a link to a better option.

 

The newer solution for adding a date to an Excel file name on output allows you to avoid the truncated table issue that the reporting feature creates.

 

Atom

I have a lengthy folder location, then "Weekly Active Item Report_" + DateTimeToday() + ".xlsx|||Weekly Active Items" built into a formula field but when I add the "Output Data" process, it fails.  What am I doing wrong?

Moderator
Moderator

Hello @llafreni,


Can you please let me know what the error message is you are getting?

Please send a copy of your workflow if possible, or a screenshot of your output tool configuration.


Thanks!

TrevorS