Change background color if value is greater or less than previous value? [closed]

asked 2018-12-14 18:46:25 +0200

MaryB gravatar image

updated 2018-12-14 18:51:30 +0200

Made a post before but it was a mess since this is my first visit to this forum and I could not edit my post. So I try again - sorry about that!

I have made a script that creates a csv file, and updates it every hour with new data added first in row and not last. How can I change the background color of cells in column if the new value is greater or less than the previous one? So, if new value is greater than the previous make the color green, if value is less than previous make it red. Since I am learning, green and red will be sufficient for now, later on I will try make it more gradient , if possible =)

Many thanks in advance! C:\fakepath\new.ods

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by MaryB
close date 2018-12-14 22:48:29.997480


In what way is the csv relevant? You surely know that csv doesn't support cell attributes, not to speak of CF.
Do you insert a new column B before entering new data? If so, how? Or do you copy/paste data moving them t the right this way.
You are talking of new data in columns. The date-time-stamps in your exaple suggest you add them in a new row. Please explain.
The conditional format you need is next to trivial, if not the way of inserting column or row spoils it.
You cannot change actually asigned cell attributes by CF, but only get the attributes of the respective cell styles overlaid to the cells inside the view. Concerning CF with gradients it's a bit different.

Lupp gravatar imageLupp ( 2018-12-14 19:43:09 +0200 )edit

Regarding csv - Just wanted to give a hint that I am opening a csv file into Calc. And yes I am adding rows only, columns are static. Trivial? Well if it was I would not have posted this and ask for help? All I have tried does not give the wanting result, usually no formatting at all so I am stuck and here I am. But nevermind I think I will manage solve it myself! Cheers!

MaryB gravatar imageMaryB ( 2018-12-14 21:29:55 +0200 )edit

If you open a csv-file with LibreOffice Clac, there is no formatting -neither constant nor conditional, because csv is a plain-text file not containing any formatting. If you want to have some formatting then, you need to set it anew. This applies in specific to Conditional Formatting.
If you opened a Calc file (ods by default) and import data into it you can have formatting and it will persist when the document is saved to a file. There can be a problem with inserted rows/columns depending on the formats that were defined in advcance and on the way in what the insertion was done.
Therefore: Please describe in detail in what way you create a new row of data. .

Lupp gravatar imageLupp ( 2018-12-14 22:19:24 +0200 )edit