Google Apps Code - Any Experts?
Discussion
I'm definitely not.
I found something to export a Google Calendar to a spreadsheet.
Works a treat, except the time is 6 hours out. I'm guessing this is due to referencing CST. But there doesn't seem to be anything that can be altered to effect GMT (or GMT+01.00 as we are now).
If there are any experts reading this, is there a simple fix?
Here is a link to the code:
https://github.com/baslemmens/exportgooglecalendar...
I found something to export a Google Calendar to a spreadsheet.
Works a treat, except the time is 6 hours out. I'm guessing this is due to referencing CST. But there doesn't seem to be anything that can be altered to effect GMT (or GMT+01.00 as we are now).
If there are any experts reading this, is there a simple fix?
Here is a link to the code:
https://github.com/baslemmens/exportgooglecalendar...
Order66 said:
When you say the time is 6 hours out - do you mean each individual item is timed 6 hours out, or the "window" from which you extract is 6 hours out?
If the former are you sure the calendar entries themselves are in GMT?
All the entries exported are -6 hours.If the former are you sure the calendar entries themselves are in GMT?
The calendar time setting is GMT & the entries reflect that.
There doesn't appear to be any setting in the code.
Maybe it can't be done.
Seems a bit odd though.
I've just had a quick look,and not tested anything but try changing this:
var details=[[mycal,events[i].getTitle(), events[i].getDescription(), events[i].getLocation(), events[i].getStartTime(), events[i].getEndTime(), myformula_placeholder, ('' + events[i].getVisibility()), events[i].getDateCreated(), events[i].getLastUpdated(), events[i].getMyStatus(), events[i].getCreators(), events[i].isAllDayEvent(), events[i].isRecurringEvent()]];
to this:
var details=[[mycal,events[i].getTitle(), events[i].getDescription(), events[i].getLocation(), events[i].getStartTime(), events[i].getEndTime(), myformula_placeholder, ('' + events[i].getVisibility()), events[i].getDateCreated(), events[i].getLastUpdated(), events[i].getMyStatus(), events[i].getCreators(), events[i].isAllDayEvent(), events[i].isRecurringEvent(), events[i].getTimeZone()]];
var details=[[mycal,events[i].getTitle(), events[i].getDescription(), events[i].getLocation(), events[i].getStartTime(), events[i].getEndTime(), myformula_placeholder, ('' + events[i].getVisibility()), events[i].getDateCreated(), events[i].getLastUpdated(), events[i].getMyStatus(), events[i].getCreators(), events[i].isAllDayEvent(), events[i].isRecurringEvent()]];
to this:
var details=[[mycal,events[i].getTitle(), events[i].getDescription(), events[i].getLocation(), events[i].getStartTime(), events[i].getEndTime(), myformula_placeholder, ('' + events[i].getVisibility()), events[i].getDateCreated(), events[i].getLastUpdated(), events[i].getMyStatus(), events[i].getCreators(), events[i].isAllDayEvent(), events[i].isRecurringEvent(), events[i].getTimeZone()]];
I just ran the script against my own calendar - only change I made was changing the start/end dates to:
var events = cal.getEvents(new Date("May 1, 2018 00:00:00 UTC"), new Date("July 1, 2018 23:59:59 UTC"));
Viewing the data in Sheets and the dates are correct, so I see no issues with this script. Would suggest the issue is somewhere in your setup, namely:
Your google profile thinks your default time is CST
Your PC thinks your default time is CST
Your calendar is set to CST
Sheets somehow is set to CST
or is your internet connection routed so that your public IP looks to be in the USA, and it is all jumping to CST automatically?
So are the dates technically correct (i.e. you have a calendar entry for 8pm locally, but it is showing as 2pm CST, or is it showing as 8pm CST)?
Have you tried running this on a different PC and different internet connection - to eliminate some automatic detection of localisation settings?
var events = cal.getEvents(new Date("May 1, 2018 00:00:00 UTC"), new Date("July 1, 2018 23:59:59 UTC"));
Viewing the data in Sheets and the dates are correct, so I see no issues with this script. Would suggest the issue is somewhere in your setup, namely:
Your google profile thinks your default time is CST
Your PC thinks your default time is CST
Your calendar is set to CST
Sheets somehow is set to CST
or is your internet connection routed so that your public IP looks to be in the USA, and it is all jumping to CST automatically?
So are the dates technically correct (i.e. you have a calendar entry for 8pm locally, but it is showing as 2pm CST, or is it showing as 8pm CST)?
Have you tried running this on a different PC and different internet connection - to eliminate some automatic detection of localisation settings?
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


