This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Particularly speaking about colors (background color, to be specific), I've done some findings:
Opening xlsx as zip, we'll find sheet data on xl/worksheets/sheet1.xml (supposing your sheet name is sheet1). Inside this xml, we'll find a list of rows and the detail of each one (cells) in a structure like this:
In red we'll see row and cell reference and in yellow a reference to the color (s refers to shade) which is in other xml.
(although the subject is very interesting and full of details, I'll stay focused in the ones needed to address the question)
The xml that contains details about each color is xl/styles.xml
There are 2 structures we need to read from that.
The first one is this
This is an array (starting in 0) where each position is related to the number referred by shade in the sheet xml. Ex: s="1" means the second row of this array, the one with fillId="2".
Now, the structure that defines the "fillId", and the color, is this one:
In yellow we'll see the RGB for each color.
Based on this concepts, I've built a sample workflow that shows which color is in each cell of a simple Excel Spreadsheet. Surely it can be evolved to a more flexible macro, but I believe the information so far is good enough to help in the problem.