Python Forum
after using openpyxl to add colors to script, black shows up white online in excel
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
after using openpyxl to add colors to script, black shows up white online in excel
#1
hi, I'm scott
I'm reasonably new to python.. but learning as I go

long story as short as I can make it
I have a script that takes some excel data, uses pandas to sort it
then a use openpyxl to add some colors and formatting to several things

the script uses this function
datecolV = '000000'



##### Colors Between Dates function Black
black_fill = openpyxl.styles.fills.PatternFill(patternType='solid', fgColor=(datecolV))
rownumber = 1
for row in sheet.iter_rows(min_row=2, max_row= sheet.max_row, min_col=8, max_col=8, values_only=True):
  rownumber += 1
  for cell in row:
    if cell == None:
      if rownumber > 2 and sheet[str('H' + str(rownumber-1))].value is not None and sheet[str('H' + str(rownumber+1))].value is not None and len(sheet[str('H' + str(rownumber-1))].value) > 9 and  len(sheet[str('H' + str(rownumber+1))].value) > 9:
        ### line below for debugging
        #print(sheet[str('H' + str(rownumber-1))].value[0:9] + ' ' + sheet[str('H' + str(rownumber+1))].value[0:9])
        if sheet[str('H' + str(rownumber-1))].value[0:9] != sheet[str('H' + str(rownumber+1))].value[0:9] and rownumber >2:
          for row2 in sheet.iter_rows (min_row=rownumber, max_row=rownumber):
            for cell2 in row2:
              cell2.fill = black_fill
on the PC.. it returns as black.. works perfect

when I upload the file to the web to send to other co-workers, the blank spaces that were colored black... dont show up... they are just white?

anybody have any ideas or has anybody run across this problem before


I can manually color the cells black in excel, and they show up fine when uploaded
only has issues if I use openpyxl to color them


[Image: Capture.png]
Reply
#2
FYI....

Changing the Colro from '000000' to '0C0C0C'.... seems to work
doesnt solve the problem, but it is a work around for now
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Count image's colors very fast flash77 18 1,298 Mar-05-2024, 06:12 PM
Last Post: deanhystad
  identify not white pixels in bmp flash77 17 2,270 Nov-10-2023, 09:21 PM
Last Post: flash77
  Excel Automation using Openpyxl pradyumnajpn 1 771 May-16-2023, 09:38 AM
Last Post: Larz60+
  can openpyxl read font colors mperemsky 3 1,655 May-09-2023, 11:18 AM
Last Post: MindKeeper
  ANSI not working for change of text colors BliepMonster 10 3,246 Nov-10-2022, 09:28 AM
Last Post: BliepMonster
  Openpyxl manipulate excel write formula SamLiu 0 1,002 Nov-04-2022, 03:00 PM
Last Post: SamLiu
  ModuleNotFound but pip shows module installed biscotty666 2 1,511 Jul-14-2022, 05:17 PM
Last Post: Axel_Erfurt
  How to do bar graph with positive and negative values different colors? Mark17 1 5,002 Jun-10-2022, 07:38 PM
Last Post: Mark17
  Trying to use 2 values from excel in my script but getting error.. cubangt 3 1,624 May-11-2022, 07:12 AM
Last Post: normanwolf
  Os command output in variable shows wrong value paulo79 2 1,467 Apr-09-2022, 03:48 PM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020