I had forgotten that getEvents() did not return a viewable array, you have to dig deeper in each event!
This script should return a stringified list of lists of all events that match. Just put an empty string for search to return all events between the two dates. The search is not case sensitive (you can search for dog where an event contains Dog)
function doGet(e){
var returnEvents = [];
var cal = CalendarApp.getCalendarById(e.parameter.calId);
var events = cal.getEvents(new Date(e.parameter.startDate), new Date(e.parameter.endDate),{search:e.parameter.search});
for (var i = 0; i<events.length; i++) {
returnEvents.push([events[i].getTitle(),events[i].getLocation(),events[i].getDescription()]);
}
return ContentService.createTextOutput(JSON.stringify(returnEvents));
}
Note the calendar service has not been completely reliable for me while testing, e.g. not always returning all results, this is between the apps script and the calendar, nothing to do with App Inventor.
Also, I left out the word return in the last part of the script earlier, sorry about that.
function doGet(e){
var returnEvents = [];
var cal = CalendarApp.getCalendarById(e.parameter.calId);
var events = cal.getEvents(new Date(e.parameter.startDate), new Date(e.parameter.endDate),{search:e.parameter.search});
for (var i = 0; i<events.length; i++) {
returnEvents.push([events[i].getTitle(),events[i].getLocation(),events[i].getDescription()]);
}
return ContentService.createTextOutput(JSON.stringify(returnEvents));
}
The error is about the format of the Google Calendar response which is in HTML not JSON, right?
Another question, the WEB1.got answer where should it be contained? Listview?
Check that your script does have the return before ContentService and that you have correctly published and deployed your script, and that you are using the correct script url.
Failing that post your aia project here (or via private message) with a screenshot of your script project and the deployment message which includes the script url.
A really big thank you for the help and availability shown! you allowed me to implement my app! Thanks again!
If you need the ".aia" file for a guide, I'm super helpful!
See you next adventure!
Hi Tim,
I need to export the selected index inside a textbox.
The division should be (e.g.):
Title_01: Textbox1
Location_1: Textbox2
Description_01: Textbox3
Use the events list created when the events are returned from Google Calendar, because this is in list format, and the selection index from the list view, then select each item.
Alternatively you could use the text split by block to split the listvew selection to a list, the delimiter should be \n