Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete row/column from Excel with xlsxwriter

Is it possible?

I know ws.set_row('B:B', options={'hidden': True})

But, is there something like ws.set_row('B:B', options={'delete_row': True})?

like image 224
PedroBiel Avatar asked Oct 24 '19 12:10

PedroBiel


People also ask

How do you delete a column in Excel using Python?

Python Delete Excel Rows and Columns In openpyxl, we can use delete_rows() and delete_cols() methods from the Worksheet object to remove entire rows and columns. The syntax is straightforward: delete_rows(row_id, number_of_rows)

How do I delete a row in Excel using vbscript?

To delete an entire row in Excel using VBA, you need to use the EntireRow. Delete method. The above code first specifies the row that needs to be deleted (which is done by specifying the number in bracket) and then uses the EntireRow. Delete method to delete it.


2 Answers

To quote the Worksheet docs:

"""
The options parameter is a dictionary with the following possible keys:

'hidden'
'level'
'collapsed'
""""

Other values like delete_row are not acceptable.

like image 109
ArunJose Avatar answered Sep 17 '22 12:09

ArunJose


It doesn't seem possible to do what you ask. Probably the best approach remains the one proposed in this old post.

like image 30
Massifox Avatar answered Sep 20 '22 12:09

Massifox