Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

php parse excel color

Is there anyway to parse a CSV by cell background color in php?
0
BTMExpert
Asked:
BTMExpert
  • 8
  • 7
  • 2
  • +1
2 Solutions
 
Dave BaldwinFixer of ProblemsCommented:
CSV is a text format without any formatting.  There is nothing to parse if it really is a CSV file.
0
 
BTMExpertAuthor Commented:
what about making a macro to delete columns with a certain background color
0
 
dkellnerCommented:
There is no way since Excel doesn't store the background color information in CSV file.

BUT.

If you extend your Excel table with an additional column and put the color codes there (as string), you can achieve what you probably need.

http://office.microsoft.com/en-us/excel-help/cell-function-HP010062392.aspx

With this function you can do it.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
dkellnerCommented:
(Wait a sec. Maybe it's not that simple...? I'm checking it)
0
 
dkellnerCommented:
No, CELL can't return such information.
Damn it.

What's the real problem?  What do you want to achieve?
0
 
BTMExpertAuthor Commented:
i have a csv that has different background color for different cells.  I only need a certain color values to show up.  I others can be deleted.  So i was trying to think of a way to save time rather than me going through and deleting the ones i don't need and saving it as a csv and then parsing it
0
 
dkellnerCommented:
> "i have a csv that has different background color for different cells"

You mean you have an XLSX that has different bg colors?
0
 
Dave BaldwinFixer of ProblemsCommented:
CSV stands for 'Comma Separated Variables' and is a plain text format.  It does not carry any formatting info so you must be talking about something else like an Excel or OpenOffice spreadsheet.  Those have a different format than CSV.
0
 
BTMExpertAuthor Commented:
it's a XLSX that i save as a csv
0
 
dkellnerCommented:
You can sort things by color.
Have you tried that?
Then it's a contiguous area that you can delete easily.
0
 
BTMExpertAuthor Commented:
that's why i was thinking of a macro that maybe could delete the correct cells in the XLSX file and then save it as a CSV
0
 
dkellnerCommented:
Okay I see.
Now if you sort the Excel, there are options for the sorting criteria and one of them is "color".  If you order by color, same colored rows go next to each other.  Doesn't that help you?
0
 
NorieCommented:
Do you know the colours associated with each cell?

Is there any other way to identify them, or even identify roughly where they are?

eg row/column in worksheet
0
 
BTMExpertAuthor Commented:
sorting them wouldn't work in this case.  I need to keep them in the same column and row, but thanks for the help anyways
0
 
BTMExpertAuthor Commented:
Guess I need a macro
0
 
NorieCommented:
The code for this should be straightforward if you do know the colours involved.
0
 
dkellnerCommented:
If you want them to stay where they are, make a plus column sequentially numbered from 1 to N so you can sort them back after you made the deletion.  Color sorting only helps your hand.  Sequential numbering will help you sort back in a jiffy and they'll be in the original order - with the colored fields missing.

(I'm not pushing it, just giving an idea.)
0
 
BTMExpertAuthor Commented:
lol i appreciate the help.  the parsing by color is a small part of the big project. I have to do more than just that.  Right now i'm just parsing the whole csv and from there taking out the values that need to be taken out.  I was just trying to do that before i get to that step.  
0
 
dkellnerCommented:
:) okay I let it go.
Thanks for the points.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 7
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now