Free Trial

Alteryx Designer Desktop Discussions

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

Adding a date to a filename and copying

SteveKnapper
8 - Asteroid

Hello, I have a requirement to copy an existing file from a folder, rename it slightly and add a date stamp

Here is my workflow which creates a batch file, but I cannot publish this to the galley to schedule as I will get into unc file structures and drive letters

What I am thinking of doing is replace the batch file output with a command line to run the filename variable which I have created, but cannot seem to pass this.

 

any suggestions much appreciated

 

AlteryxCopy.PNG

9 REPLIES 9
DavidP
17 - Castor
17 - Castor

Is it possible to use the absolute path, i.e. \\servername\foldername\..\newfilename.xlsx ?

 

If your Alteryx server has access to write to that path, you could just use an Output Data tool. Just make sure the Output is unchecked under Manage workflow assets when you publish it.

 

filename.png

SteveKnapper
8 - Asteroid

Hello, what is the tricky bit is that I am compiling a variable which is the filename plus the current date

 

Steve

 

DavidP
17 - Castor
17 - Castor

That's fine, if you look at the example I show above for the Output data tool, you pick the option "Take file/Table name from field" and also "Change entire filepath". Below it you can then pick the field name that contains your file path and filename. In my example the field is filename.

 

With an Excel file, the field also has to include the sheet name, so your filename field should look something like this:

 

"\\servername\foldername1\foldername2\testfile.xlsx|||sheet1$"

DavidP
17 - Castor
17 - Castor

In your case probably

 

"\\servername\foldername1\foldername2\testfile 2018-11-20.xlsx|||sheet1$"

SteveKnapper
8 - Asteroid

Hi David, thanks for that could you supply your example workflow please with a directoyas I have made the change but get the error a record was created with no fields, so the original data is lost and the new file is being created but just with the filename and path.

 

I think it might be relevant to the sheet which is Page1 from the Excel source file.

 

regards

steve

 

DavidP
17 - Castor
17 - Castor

Here you go. Have a look at the configuration of the output data tool.

 

new filename with date.png

DavidP
17 - Castor
17 - Castor

Sorry, forgot to include the input file. You'll just have to update both the input path and output path.

 

 

SteveKnapper
8 - Asteroid

many thanks for you help, as with lots of things I was trying to over complicate the requirement.

 

regards

Steve

 

prasadpvrs
7 - Meteor

Hi David,

 

While I am  adding date date and copying the data from .CSV to .XLS file,I am getting below.

 

Microsoft Access Database Engine: Syntax error in CREATE TABLE statement.\3000 = -53746428

 

Could you please help me in this regard.

 

Regards,

Prasad.

Labels
Top Solution Authors