Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

How to combine two specific scripts together?

Hi guys. I´m new to this place and bad coder, so sorry to write here like a rookie.

I read many manuals how to combine two scripts together, but didn´t help me with my task. Because I´m coding analphabet. And yet, I need the coding.

This script bellow (highlightNotes) , works very nice alone. But I need to execute it everytime when I edit the Google Sheet. Probably merge it with function onEdit(e) ?

/**
Here is the script, that fills the background color, where Note is inserted.
*/

 

function highlightNotes() {
  const sheet = SpreadsheetApp.getActiveSheet();
  const range = sheet.getDataRange();
  const notes = range.getNotes();
  const orange = notes.map(row => row.map(note => note ? 'orange' : ''));
  range.setBackgrounds(orange);
}
 
That script executes only when I play it manually. I need to keep it active in background all the time.
 
I tried different combinations, how to merge onEdit and function highlightNotes(), but I´m really bad with codes.
Can someone write it completaly for me?
 
Thank you guys, Martin.
Solved Solved
0 4 1,604
2 ACCEPTED SOLUTIONS

Thank you Marc. OK. Will ask "There".

I thought (as a beginner in coding), that it could be a simple stitch of these to scripts together, with a little efford.

So it seems, is not.

Thank you, Martin.

View solution in original post

Just ask chatGPT for help on that one

View solution in original post

4 REPLIES 4
Top Labels in this Space