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?
Example of my sheet is here https://docs.google.com/spreadsheets/d/1qG_P_EYnEw28pfIQew7ZbpmvgO6Ie5D0HpsezoCMNCg/edit?usp=sharing

Thank you guys, Martin.

This forum is for Appsheet, got App Script. I know there’s a good sub on reddit for App Script where you should be able to get help.

But if you’re asking for someone to “write it completely for me” I’d suggest you hire someone, like on Fiverr or Upwork. That kind of language doesn’t really come across well when asking people for help for free.

2 Likes

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.

Just ask chatGPT for help on that one

1 Like

Great, Rafael.

I managed to solve it! Never used chatGPT for that. Amazing results!

Thanks a lot. Martin