cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting a Table from Excel Using ABAP2XLSX

hamida_ashna
Explorer
374

Hello, everyone.

I'm working with ABAP2XLSX and need to delete an existing table from an Excel file. However, I haven't been able to find a method in the ZCL_EXCEL_WORKSHEET class that allows me to remove a table.

Does anyone have any advice?

Thanks in advance.

abo
Active Contributor
0 Kudos

If you wish to delete a whole tab, look into ZCL_EXCEL_WORKSHEETS (with S at the end).

The REMOVE method should be the one for you.

View Entire Topic
hamida_ashna
Explorer
0 Kudos

@abo 

Unfortunately, it doesn't work (deleting of rows). The reason is that the ZCL_EXCEL_WORKSHEET class includes the TABLES attribute with all information about tables on that file. When we attempt to write data back to the file, the TABLES attribute in the writing method will recreate that table.

abo
Active Contributor

Since I haven't tried yet this same scenario (never had to, but I can understand that it makes sense!) I am not sure I can help you further here.

The other suggestion about "clear" might be worth exploring, though it shouldn't be that different from removing the worksheet altogether.

What you could do, though, is write a short sample program to demonstrate this use case, together with a sample file, and raise an issue on Github.

It might simply be that the API for this operation is missing, the project grows when people implement a feature they need or fix a bug which bothers them 🙂