I need to create a function in AppScripts that sends an email to my email with the current time. Later, I have to create a trigger that forces the function to run once every hour. I know it will be very easy for the majority of you, but I am starting with coding and I am stuck with this exercise.
This is what I´ve written:
function sendemail(){
function getDate() {
var d = new Date();
return (d.getMonth()+1) + "/" + d.getDate() + "/" + d.getFullYear();
}
function getTime() {
var d = new Date(),
offset = -d.getTimezoneOffset()/60,
h = d.getUTCHours() + offset,
m = d.getMinutes(),
s = d.getSeconds();
return h + ":" + m + ":" + s;
}
function getDateAndTime() {
return getDate() + " " + getTime();
Gmail.sendEmail({
to: "[email protected]",
subject: "Hora actual",
htmlBody: "La hora actual es +dateofDay <br/> Regards, Your robot",
});
}
}
But it doesn´t work. I´m getting a bit frustrated and the same error appears all the time: "Script function not found: doGet".
Can anyone have a look at it and help me?
Thanks in advance, very appreciated.
Best regards, Luis
sendemail()- what kind of google apps script is it [standalone, bound, web app]? If it is a Web App script, see the requirements here - random-parts