[resolved] Excel file generation dynamically,different name for each excel

One Star

[resolved] Excel file generation dynamically,different name for each excel

Hi All,
After a long time i am posting something.
I hope you all will reply to my query like previously.
I am processing 10 csv files which are in one folder and want to load the data in excel file.
But excel file should generate dynamically.
Here what does it mean dynamically????
It means for every CSV file,an excel should get generate with the same name of CSV.
e.g.
Cust1.csv then excel file should generate with name of Cust1.xls
Cust2.csv then excel file should generate with name of Cust2.xls
.
.
.
.
.
.
.
Cust10.csv then excel file should generate with name of Cust10.xls
I am waiting for the reply...

Accepted Solutions
Moderator

Re: [resolved] Excel file generation dynamically,different name for each excel

Hi kunalrane,
What's your issue for context value?
Have you tried global variable
((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")).replace("txt", "xls")

Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

All Replies
Four Stars

Re: [resolved] Excel file generation dynamically,different name for each excel

Hi Kunal,
You will have to perform the string handling operation like LEFT and Concatenation...
In your output file name, use LEFT and extract the file name from CSV file name or currentFileName variable and concatenate with ".xls"
I hope you got an idea.
Vaibhav
Five Stars

Re: [resolved] Excel file generation dynamically,different name for each excel

take CSV name and assign it to context or global variable and then do following action in output excel components file name field.
context.FilePath+context.FileName.toUpperCase().replace(".CSV", ".XLS")

hope this will work.
One Star

Re: [resolved] Excel file generation dynamically,different name for each excel

Hey hi Umesh,
Sorry but its not working...I have tried.
I want to generate excel file dynamically with names as source files.
One Star

Re: [resolved] Excel file generation dynamically,different name for each excel

Hi Kunal -
This is not exactly what you're asking for, but it will give you ideas on how to solve your particular problem:
http://www.talendforge.org/forum/viewtopic.php?pid=131115#p131115
Another one is - http://www.talendforge.org/forum/viewtopic.php?pid=130539#p130539
For dynamic schemas, see https://help.talend.com/pages/viewpage.action?pageId=5671283
umeshrakhe has already shown how to assign the file name to a variable and change its extension from csv to xls.
Let us know if you're not able to make progress...
Moderator

Re: [resolved] Excel file generation dynamically,different name for each excel

Hi kunalrane,
What's your issue for context value?
Have you tried global variable
((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")).replace("txt", "xls")

Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.