Setting margins and other page properties on a worksheet

219 views
Skip to first unread message

Kristian Petersen

unread,
Dec 12, 2021, 1:59:56 PM12/12/21
to openpyxl-users
I'm a bit new to using openpyxl so forgive me if I ask what seems to be a question with an obvious answer.

I'm working with an existing Excel spreadsheet and trying to figure out how to adjust margins on the worksheets in the Python code.  I found the openpyxl.worksheet.page module, but I'm not sure how to use that with the worksheets I have to set the properties for them.  Any help would be appreciated.

Thanks!

Charlie Clark

unread,
Dec 14, 2021, 6:25:17 AM12/14/21
to openpyxl-users
There's not really a lot I can say to help. Openpyxl implements the OOXML specification here so you'd have to check with that. However, you can generally work backwards from an existing workbook, which has the settings you want.

Charlie

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Sengelsweg 34
Düsseldorf
D- 40489
Tel: +49-203-3925-0390
Mobile: +49-178-782-6226

Kristian Petersen

unread,
Dec 14, 2021, 8:15:05 AM12/14/21
to openpyx...@googlegroups.com
How do I even view the existing margin settings of a worksheet in openpyxl?  I have to be able to see this somehow to confirm a change. 

--
You received this message because you are subscribed to a topic in the Google Groups "openpyxl-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openpyxl-users/Thpq6LuwZp4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openpyxl-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openpyxl-users/41FB9729-6AAD-464E-9E46-5A97AAF6B44C%40clark-consulting.eu.
Reply all
Reply to author
Forward
0 new messages