Another_coder
Another_coder

Reputation: 810

change width and heigth of a cell from xlwings

I am working with an excel file from xlwings and I want to change the width and height of each cell from code, ideally to create a perfect square, is that possible?

In the documentation, I found a height attribute when using range:

ws1.range('A1').height

but it is read only, so that doesn't help.

I know there is a autofit method in xlwings that works perfectly well to set the width/height of the cell, so influencing those attributes shold be doable, or am I missing something?

Upvotes: 1

Views: 3945

Answers (1)

mouwsy
mouwsy

Reputation: 1933

You can check out the docs and try out integers:

sheet.range("A1").column_width = 100
sheet.range("A1").row_height = 100

Upvotes: 2

Related Questions