Write csv_file with current date as name affix

Hello all together,

we do have another question:

in our workflow we read a csv-file with the file-reader-node and update a database table with this file. After updating the database table we write the the csv-file to an archiv-folder.

Is there a possibilitiy to append the current date to the name of the csv-file in the csv-writer-node?

Thanks for help,


I usually use a 3 nodes to do this:

Table Creator:  Set file path

Java Snippet: 

// Your custom imports:
import java.text.SimpleDateFormat;

// Enter your code here:
String date = "";
Date dt = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyMMdd");
date = df.format(dt);

out_Path =(c_Path  + date + ".csv");

Table Row to Variable:  Allows the filename to date to be used as a flow variable.

You just need to set the filename flow variable in the CSV writer node.

Hope this helps


Hello Macca,

thanks for your answer!

The java snippet node gives an error message to me:

"WARN  Java Snippet         4:55       Compile with errors:
Error: Out_Path cannot be resolved to a variable
Error: C_Path cannot be resolved to a variable"

C_Path is the name of the variable in the table creator node. The variable contains the path and the name of our csv-file without ".csv".

Can you help with this error?






You can also generate the current date with a Time Generator (1 Row and the option use Execution time)

Than cross Join the 1 row to your complete data table and convert it into a string with the date to string node.

Cheers, Iris

I have attached a workflow that solves your problem.

Hello Macca,

it worked!!!  The error message in the java snippet is resolved.

I had to change the name of the new variable with path, name and date into a name without out_. Furhtermore a definition of the variable as string was necessary. With this we could define the java snippet output-variable out_PathNameDate:

String PathNameDate = "";
PathNameDate = (c_C_Path + date +".csv");    

out_PathNameDate = PathNameDate;

Thank you very much


Hi Iris, so you know if the Time Generator module going to be updated to non-legacy? It's a useful module and I'd like the date & time type to be updated so I don't have to cast it

I’m unsure how to open this file type using KNIME…is it not a regular workflow?

Hi @dg-clarkston and welcome to the forum.

This workflow was a bit old - and the user above had just zipped up the workflow folder in his workspace, as opposed to exporting it. Here’s an exported workflow for you:

Date.knwf (19.7 KB)

Thanks @ScottF! I had not encountered the zip files but imported it directly after extraction and it worked fine.