Hello all,
I've been trying to figure this out for a little while and thought that I would just ask for some help.
My data looks like the following:
A1= 1/5/2015
A2= 2/6/2015
A3= 3/7/2015
B1= Playground A / School A (Project 123)
B2= Playground B (Project 91); Playground C (Project 8)
[FONT=arial, sans, sans-serif]B3=School B (243), School C (231)[/FONT]
[FONT=arial, sans, sans-serif]Each site has a name and unique project ID# and is ordered chronologically by the event date. (I found a nice script online for pulling google calendar events into google sheet: see my script below). However as you can see, it is not consistently entered and some lines have more than one entry. Also, the ID#s are not necessarily the same number of digits (ex: 1, 12, 123).[/FONT]
[FONT=arial, sans, sans-serif]I am looking for a way to extract the ID# from each string and then pull the most recent date from the adjacent cell. I was thinking along the lines of an index//match and maybe a wildcard function; or [/FONT]I was looking for a way to find ")" and then search backward for the number. [FONT=arial, sans, sans-serif]I am still unsure how to wrap my head around it.
Any and all help would be appreciated. Thanks!
Script I plugged into google sheets:
[/FONT] function listEvents() {
var today = new Date();
var Calendar = CalendarApp.getCalendarById("NAME OF MY CALENDAR");
//var Calendar = CalendarApp.getDefaultCalendar();
var events = Calendar.getEvents(new Date(today.getFullYear(),1,1), new Date(today.getFullYear(),12,31));
var eventarray = new Array();
for (var i = 0; i<events.length; i++)
{
var line = new Array();
line.push(events.getTitle());
line.push(events.getStartTime());
line.push(events.getEndTime());
line.push(events.getLocation());
eventarray.push(line);
}
var sheet = SpreadsheetApp.getActiveSheet().getRange(2, 1, eventarray.length, eventarray[0].length).setValues(eventarray);
}
I've been trying to figure this out for a little while and thought that I would just ask for some help.
My data looks like the following:
A1= 1/5/2015
A2= 2/6/2015
A3= 3/7/2015
B1= Playground A / School A (Project 123)
B2= Playground B (Project 91); Playground C (Project 8)
[FONT=arial, sans, sans-serif]B3=School B (243), School C (231)[/FONT]
[FONT=arial, sans, sans-serif]Each site has a name and unique project ID# and is ordered chronologically by the event date. (I found a nice script online for pulling google calendar events into google sheet: see my script below). However as you can see, it is not consistently entered and some lines have more than one entry. Also, the ID#s are not necessarily the same number of digits (ex: 1, 12, 123).[/FONT]
[FONT=arial, sans, sans-serif]I am looking for a way to extract the ID# from each string and then pull the most recent date from the adjacent cell. I was thinking along the lines of an index//match and maybe a wildcard function; or [/FONT]I was looking for a way to find ")" and then search backward for the number. [FONT=arial, sans, sans-serif]I am still unsure how to wrap my head around it.
Any and all help would be appreciated. Thanks!
Script I plugged into google sheets:
[/FONT] function listEvents() {
var today = new Date();
var Calendar = CalendarApp.getCalendarById("NAME OF MY CALENDAR");
//var Calendar = CalendarApp.getDefaultCalendar();
var events = Calendar.getEvents(new Date(today.getFullYear(),1,1), new Date(today.getFullYear(),12,31));
var eventarray = new Array();
for (var i = 0; i<events.length; i++)
{
var line = new Array();
line.push(events.getTitle());
line.push(events.getStartTime());
line.push(events.getEndTime());
line.push(events.getLocation());
eventarray.push(line);
}
var sheet = SpreadsheetApp.getActiveSheet().getRange(2, 1, eventarray.length, eventarray[0].length).setValues(eventarray);
}