Using Applescript to append user input to existing note in Notes App

applescriptnotes.app

I've been using this little utility to save out random thoughts through the day to a text file.
I want to append the user input to an existing note in the notes APP, but can't figure out getting beyond simply calling the notes app.
Any help would be greatly appreciated!
Extra credit: If anyone has experience using Applescript to send data to a Google Sheet, I'd appreciate any resources – I have had a tough time finding any.

Thanks!

Here is my working script that logs user input to a text file.

set f to "/Users/Weston/Desktop/JAT.txt"
set myDate to date string of (current date)
set myTime to time string of (current date)
set myStamp to myDate & " " & myTime


set JAT to text returned of (display dialog "What's on your mind, Weston?" default answer " " with icon note buttons {"Cancel", "Continue"} default button "Continue")

set entry to return & ">" & myStamp & " | " & JAT

set myFile to open for access f with write permission
write entry to f starting at (get eof of f) + 1
close access myFile

quit

Best Answer

This question explains how to modify text on Notes, so here's how that would be implemented in your code:

set noteName to "JAT"
set myDate to date string of (current date)
set myTime to time string of (current date)
set myStamp to myDate & " " & myTime


set JAT to text returned of (display dialog "What's on your mind, Weston?" default answer " " with icon note buttons {"Cancel", "Continue"} default button "Continue")

set entry to return & ">" & myStamp & " | " & JAT

tell application "Notes"
    tell account "iCloud"
        set body of note noteName to (get body of note noteName & entry)
    end tell
end tell

quit

Don't forget to create the note first, though.