Openpyxl - How To Set Print Area For A Worksheet
I am trying to use OpenPyXL to create invoices. I have a worksheet with an area to be printed and some notes outside of that range. I have most everything working but I am unable t
Solution 1:
In the current version of openpyxl (2.5.4 at time of writing), this is done using:
Worksheet.print_area = "A1:L25"
Docs are here.
Solution 2:
This isn't currently directly possible. You could do it manually by creating a definedNamed using the reserved xlnm
prefix (see Worksheet.add_print_title
for an example.
Solution 3:
this:
wb.create_named_range('_xlnm.Print_Area', ws, 'A1:U56',scope=0)
worked for me, the scope is mandatory.
Post a Comment for "Openpyxl - How To Set Print Area For A Worksheet"