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?

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download