Here's my code:
function transferNotes() {
// Get notes (not comments) from the source spreadsheet
var sourceSpreadheet = SpreadsheetApp.openById('1GdoTw3KxQO03xp5CiKX9VIJMZQfPMPbGdCa_PvnQaoI');
var sourceTab = sourceSpreadheet.getSheetByName('SpA')
var sourceRange = sourceTab.getRange('D2:D2000');
var notes = sourceRange.getNotes();
// Post the notes to the target spreadsheet
var targetSpreadheet = SpreadsheetApp.openById('1YApnQ64OYFOYKQrefuxJ0gwpchAKRatWpJsSNLeevO4');
var targetTab = targetSpreadheet.getSheetByName('SpB');
var targetRange = targetTab.getRange('D2:D2000');
targetRange.setNotes(notes);
}
I want to run this code on multiple sheets at once and automatically update notes in real time without having to run the script every time to update it. Help me.