Google Apps Code - Any Experts?
Google Apps Code - Any Experts?
Author
Discussion

Smiler.

Original Poster:

11,752 posts

261 months

Saturday 30th June 2018
quotequote all
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...


Order66

6,740 posts

280 months

Saturday 30th June 2018
quotequote all
did you try changing the line that references CST to GMT?

Smiler.

Original Poster:

11,752 posts

261 months

Saturday 30th June 2018
quotequote all
Yep, made no difference.

Order66

6,740 posts

280 months

Saturday 30th June 2018
quotequote all
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?

Smiler.

Original Poster:

11,752 posts

261 months

Sunday 1st July 2018
quotequote all
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.

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.

Thats What She Said

1,180 posts

119 months

Sunday 1st July 2018
quotequote all
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()]];


Order66

6,740 posts

280 months

Sunday 1st July 2018
quotequote all
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?

Smiler.

Original Poster:

11,752 posts

261 months

Sunday 1st July 2018
quotequote all
Cheers you two, will try your suggestions & report back.