Conditional Formatting Google Sheet - google-apps-script

I am working on a google sheet,I want to highlight the price change between 2 sheets.Based upon SKU.Mean if there is difference in the price (col B) in sheet1 and sheet2 then that item should be highlighted.
I have done this functionality using Google Apps script but it is taking time to process the data in bulk.
I am looking to complete this using inbuilt google functions(Conditional formatting rule).
Is there a way to achieve this using Google inbuilt function.
Here is the sheet url : https://docs.google.com/spreadsheets/d/1i2rpqFLh-E7A3F2eAXj16dHILRuvyv4iRapkf13TbBQ/edit?usp=sharing
Expected Output : https://docs.google.com/spreadsheets/d/1xmJt3qjQF2JQD2kXivTPPjdbqkJaG_NMuSXTUexm0UI/edit?usp=sharing

Related

IMPORTRANGE without opening the Sheet manually

I have a custom function built for our Google Sheet 1. Then, using IMPORTRANGE, a number is imported from Google Sheet 1 to Google Sheet 2. The number in Google Sheet 1 is calculated using the custom function mentioned before.
The issue is that, if Google Sheet 1 is not opened manually, the IMPORTRANGE function in Google Sheet 2 will show up as #NAME, and only fix itself once a user enters Google Sheet 1.
Is there any way to fix this issue, without having a real person enter Google Sheet 1?

How to open a google sheets spreadsheet at a specific row?

I have a google sheet with a column that contains the dates of the year. It is used as a planning. Using conditional formatting, the date of today is coloured green. It would be nice to always open the spreadsheet at this specific row, when the document is loaded. Is this possible using Google Apps Script or using another Google Sheets setting?
Try
Sheet.getRange(row,1).activate()

How to prevent the NOW() function in google sheet to update everytime when there is a change in the cells in the sheet?

I want to print the timestamp in column C when the status shows "Complete". However, when I use the NOW() function, it will keep updating the cells when there is a change in other cells. My formula in Cell C4 is =IF(B4="Complete",NOW(),""). This formula are not able to solve the problem of auto-updating. May I know is there anyway to handle this situation? If the Google App Script is the only way (hopefully not), how should I code it (first time deal with JavaScript)?
In Google Sheets there is no way to stop NOW() from recalculating other than replace it by it's value.
The best way to achieve what you are looking for is to use Google Apps Script, more specifically you will have to use an on edit trigger. Below is an example based on what is shown in the screenshot included in the question:
function onEdit(e){
if(e.range.columnStart === 2 && e.range.rowStart >= 4 && e.value === 'Complete'){
e.range.offset(0,1).setValue(new Date());
}
}
Please read Extending Google Sheets with Apps Script. This is a very brief guide to get started with using Google Apps Script with Google Sheets and will point you to the resources to learn the basics of JavaScript.
NOTE: JavaScript and Java are two different programming languages.
Related
Automatic timestamp when a cell is filled out
How to automatically add a timestamp in google spreadsheet
Is there a way to freeze TODAY for when it was written to a cell in Google Sheets?
Your formula is correct but need to change little things. You should write this formula in this way if(C4,C4,if($B4="Complete",NOW(),"")). and go to the file menu then spredsheet settings then calculation and then recalculation and at last its change to "On Change".

Google Sheets script general mechanics

I have put together a rather large script file that does a lot of math. It seems to me that if I place a script variable value on the spreadsheet (setValues()), the whole spreadsheet recalcs (i.e.; it takes awhile to refresh). Is that true?
What if I want to format a cell from script (e.g.; change a number cell to a percentage cell with 3 places)[FormattedSS.getRange(rangecoordinates).setNumberFormat("#.###%");]? When I set the format, does the whole spreadsheet recalculate?
I am new to Google Sheets. In Excel, I could set calculation off. Google sheets does not seem to have that option.
Google sheets has no manual calculation option. You would need to create a formula to check whether to run the rest of the formula. If the output is a single cell you can easily use a circular reference to retain the value.
When it comes to Google App Scripts every time you execute a script there will be an annoying delay, that is just how it works, the App Script should be avoided at all cost in a normal spreadsheet except for when actually necessary.
Google App Script Server -> Google Sheet (delay to send information back and forth)
Google Sheet always recalculates after any change

Is it possible to use IMPORTXML function and modify it with a query?

I am creating a spreadsheet portfolio. I came across some limitation, e. g. that I can not automate the process of importing the data from a website for different stocks. This is since the Index for the stock information on the website is often different from another stock. However there is the pattern that it is the next Index from a defined string e. g. "Branche". This made me wonder if I can automate the process with the Google Apps Script.
I wrote down the steps at first in Google Sheets. Then I formulated the steps in the Google Apps Script. Now I am stuck.
Step 1
=IMPORTXML("https://www.comdirect.de/inf/aktien/detail/uebersicht.html?ID_NOTATION=9386126";"//tr/td[#class='simple-table__cell']")
Step 2
=IMPORTXML(CONCATENATE("https://www.comdirect.de/inf/aktien/detail/uebersicht.html?ID_NOTATION=";"9386126");"//tr/td[#class='simple-table__cell']")
Step 3
=INDEX(IMPORTXML(CONCATENATE("https://www.comdirect.de/inf/aktien/detail/uebersicht.html?ID_NOTATION=";"9386126");"//tr/td[#class='simple-table__cell']");62;1)
Step 4 final product - just an idea not working yet
function import_branche() {
var url1 = "https://www.comdirect.de/inf/aktien/detail/uebersicht.html?ID_NOTATION="
var ulr2
var ticker = "//tr/td[#class='simple-table__cell']"
Index = find the INDEX with the String == "Branche"
return Index(IMPORTXML(CONCATENATE(url1;url2); ticker);(Index+1);1)
}
Ideally, I would like to have a function where I only need insert the link of the website and get the result. Here is the index for the information automatically found.
Google Apps Script can't execute Google Sheets spreadsheet functions like IMPORTXML, so you have two basic alternatives
Use Google Apps Script to get the result of a IMPORTXML formula from the spreadsheet, then use JavaScript to do the rest of the job
Do the job completely using Google Apps Script and JavaScript
Related
Google docs ImportXML called from script
(javascript / google scripts) How to get the title of a page encoded with iso-8859-1 so that the title will display correctly in my utf-8 website?