Conditional Formatting Rule() undefined

93 vistas
Ir al primer mensaje no leído

Ryan Ma

no leída,
6 nov 2017, 7:55:46 p.m.6/11/17
para openpyxl-users
Hello,
I am relatively new to coding. I want to automate one of the reports i run at work since it takes about 10-15 minute of my time a day
I am getting undefined name 'Rule' error when i type in the highlighted in to my IDE. Essentially what im trying to do is if the cell
in COL D has the word 'PEFI' highlight that COL orange. 
#format for LDC Status to highlight accounts going final

orange_fill = PatternFill(bgColor='ffbb4f')
black_text = Font(color='000000')
dxf = DifferentialStyle(font=black_text, fill=OrangeFill)
rule = Rule(type='containsText',operator='containsText', text='PEFI',dxf=dxf)
rule.formula = ['NOT(ISERRROR(SEARCH("PEFI",D1)))']
ws.conditional_formatting.add('D:D',rule)
Please let me know why im getting this error. Im basing my formatting off the example on the conditional formatting examples given on the webpage.
also if anyone has an example where i can mirror the conditional formatting for finding text it would be greatly appreciated!

Thanks
Ryan

John Serrano

no leída,
31 mar 2022, 6:19:05 p.m.31/3/22
para openpyxl-users
Hi Ryan,
What IDE did you use in 2017 and what IDE would you recommend for openPYXL in 2022?
Thank you,
John Serrano

Charlie Clark

no leída,
1 abr 2022, 3:29:42 a.m.1/4/22
para openpyxl-users
On 1 Apr 2022, at 0:19, John Serrano wrote:

> Hi Ryan,
>
> What IDE did you use in 2017 and what IDE would you recommend for openPYXL
>
> in 2022?

Personally, I use WingIDE and would recommend it for Python but IDE's can be a very personal choice.

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
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos