I'm fairly new to AppScript, so I apologise if this is crazy easy and I'm just hopeless. I've searched a bunch, but solutions were all in slightly different formats that I wasn't sure how to utilise.
The script works to import my sheets information into the calendar, but I want my first column to be a formula column and I can't figure out how to ignore it while using LastRow.
I got the code from a tutorial online, but if you all have suggestions on what to do better/differently, let me know. Thank you!
I've tried a few different iterations in this line:
var count = spreadsheet.getRange("B2:H"+lr+"").getValues();
But I it's been trial and error, with only errors being the result.
function CreateEvent() {
var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarId = spreadsheet.getRange('K1').getValue();
var eventCal = CalendarApp.getCalendarById(calendarId);
var lr = spreadsheet.getLastRow();
Logger.log(lr);
var count = spreadsheet.getRange("B2:H"+lr+"").getValues();
for (x=0; x<count.length; x++) {
var shift = count[x];
var summary = shift[0];
var guests = shift[2];
var description = shift[3];
var location = shift[4];
var startTime = shift[5];
var endTime = shift[6];
var event = {
'location': location,
'description': description,
'guests':guests +',',
}
eventCal.createEvent(summary, startTime, endTime, event)
}
}