Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to read the excel file table starting from the row color and compare with the 2nd file with the same format

I have a excel file like this Table
Have to read the table under the row in red and store in df and read the next table starts from red and store in another df similarly for next table alone with the same of row in red.
How to find the first row in red which may start from row 10 or 20 or column A or B or C and store in DF accordingly
Appreciate your help in advance

Tried openpyxl but unable to store the data in 3 different df for 3 different table

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try to identify the cell color is red or not first

def is_red_color(cell):
    return cell.fill.start_color.rgb== 'FFFF0000'
sheet=workbook.active
cell_color = sheet['B302']

if is_red_color(cell_color):
    print("Cell is read")
else:
    print("not red")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading