Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I need to run though a folder,convert all the excel files to CSV and save these CSV files in a folder named after the current date.These csv files must be renamed in HHmm format(a file per minute).
Here is my job:
tFileList_1 --> tFileInputExcel_1 --> tFileOutputDelimited_1
|
Subjob OK
|
tFileCopy_1
However,the converted csv file is saved in the same folder and not the new one.
The CSV file only copies the first column.
Instead of the csv,the excel file is renamed and saved in the new folder.
In your tFileOutputDelimited, just set the File Name field like this:
"C:/Users/../" + TalendDate.formatDate("dd-MM-yyyy", TalendDate.getCurrentDate()) + "/" + TalendDate.formatDate("HHmm",TalendDate.getCurrentDate()) + "." + ((String)globalMap.get("tFileList_1_CURRENT_FILEEXTENSION"))
Then in Advanced settings tab tick the option "Create directory if does not exist".
It should work.
Here are my current settings :
tFileOutputDelimited_1 Filepath : ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
tFileCopy destination folder : "C:/Users/../" + TalendDate.formatDate("dd-MM-yyyy", TalendDate.getCurrentDate())
tFileCopy destination file : TalendDate.formatDate("HHmm",TalendDate.getCurrentDate()) + "." + ((String)globalMap.get("tFileList_1_CURRENT_FILEEXTENSION"))
In your tFileOutputDelimited, just set the File Name field like this:
"C:/Users/../" + TalendDate.formatDate("dd-MM-yyyy", TalendDate.getCurrentDate()) + "/" + TalendDate.formatDate("HHmm",TalendDate.getCurrentDate()) + "." + ((String)globalMap.get("tFileList_1_CURRENT_FILEEXTENSION"))
Then in Advanced settings tab tick the option "Create directory if does not exist".
It should work.
Thank You! This resolved my initial problem.
My excel file is indeed converted into csv which is then renamed so your code worked! However, the csv file is empty and i get this exception : jxl.read.biff.BiffException: Unable to recognize OLE stream
at jxl.read.biff.CompoundFile.<init>(CompoundFile.java:116)
at jxl.read.biff.File.<init>(File.java:127)
at jxl.Workbook.getWorkbook(Workbook.java:268)
at local_project.test_0_1.Test.tFileList_1Process(Test.java:728)
at local_project.test_0_1.Test.runJobInTOS(Test.java:1301)
at local_project.test_0_1.Test.main(Test.java:1151)
I do have the "read excel2007 format (xlsx)" option unchecked.When i check it i only see the first column in my csv file