How can I delete a Worksheet from an Excel workbook?

Nine Stars

How can I delete a Worksheet from an Excel workbook?

What component do I use to delete a worksheet from an Excel workbook?
Four Stars

Re: How can I delete a Worksheet from an Excel workbook?

Hi talendtester,
I couldn't identify a component to delete a worksheet..
But there is a work around -- read excel file and all the worksheets except the one which you want to delete and connect to outputexcel new file. Once done, delete old excel file.
Check the blog post - http://www.vikramtakkar.com/2012/12/reading-excel-files-using-talend-open.html...
Vaibhav
Seventeen Stars

Re: How can I delete a Worksheet from an Excel workbook?

There is an easy way:
tFileExcelWorkbookOpen --OnSubjobOk--> tFileExcelWorkbookSave
In tFileExcelWorkbookOpen specify your source file.
In the component tFileExcelWorkbookSave you can specify the sheets to delete and you can specify an output file name different or simply the same from the source file.
Nine Stars

Re: How can I delete a Worksheet from an Excel workbook?

Thanks jlolling,
I get this error on the tFileExcelWorkbookSave at the very last step of the job:
Exception in component tFileExcelWorkbookSave_1
java.lang.IllegalArgumentException: workbook cannot be null!

Here is my job:
tFileExcelWorkbookOpen > tFileExcelSheetList > tMap (if statements to make the ones I don't want to load null) > tFilterRow > tFileOutputDelimited > okComponentOk > tFileInputFullRow > tMap > tContextLoad > tFlowToIterate > tFileExcelWorkbookSave
Nine Stars

Re: How can I delete a Worksheet from an Excel workbook?

jlolling,
Do I need to make 30 context variables, load them all, and the call them in the tFileExcelWorkbookSave component so all the worksheets can be deleted in a single pass?