Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Appending Timestamp to output file

VS
7 - Meteor

Hello everyone,

 

I am trying to save an output file (*.xslx) with date and time but not able to do so.

 

When using formula "XXX\4april\"+TOSTRING(DateTimetoday())+"_outputfile.xlsx|sheet1", it is working fine but file getting saved as XXX2017

 

When using formula "XXX\4april\"+TOSTRING(DateTimenow())+"_outputfile.xlsx|sheet1", getting the below error

 

Unable to Open archive for zipping: XXX\4april\2017-04-07 12:55:43_outputfile.xlsx Error Opening file: \4april\2017-04-07 12:55:43_outputfile.xlsx: The filename, directory name, or volume label syntax is incorrect. 

 

As per output file setting, I am using 

  • write to " \4april\outputfile.xlsx|||Sheet1"
  • Output Options:Overwrite file(Remove)
  • change entire file path option 

Appreciate any help.

 

Thanks

VS

2 REPLIES 2
PaulN
Alteryx Alumni (Retired)

Hi @VS,

 

 

 

In the second case, your error is caused by colon (":") which is not a valid character for a file path.

 

You could try one of these 2 options to get rid of it:

 

Remove ":" :

 

"XXX\4april\"+replace(DateTimenow(),":","") +"_outputfile.xlsx|sheet1"

 

Format datetime (link from help) :

 

"XXX\4april\"+ DateTimeFormat(datetimenow(),"%Y-%m-%d %H%M%S")  +"_outputfile.xlsx|sheet1"

 

Both will return something like:

 

XXX\4april\2017-04-07 131642_outputfile.xlsx|sheet1

 

Thanks,

 

Paul Noirel

Customer Support Engineer

epilady
7 - Meteor

I used the method "XXX\4april\"+replace(DateTimenow(),":","") +"_outputfile.xlsx|sheet1" to populate the time stamp onto the output file name.  Unfortunately, this gave me a file per execution second.  To get a single file name for the execution of the workflow I was forced to manipulate the time portion replacing the second digit of minute and both digits of seconds with zeros.

 

Below is how I accomplished the task returning File_Name_20171010_175000

 

"File_Name_" +

SubString(
  Replace(
    Replace(

        TOSTRING(Replace(DateTimenow(),":",""))

    ,"-","")
  ," ","_")
,0,12) + "000"

Labels