I am trying to get the Newest date in column A which is formatted as date time.
Currently I have the following Script which will set a filter on Column A and filter out anything newer than 28 days.
Somebody might run this report a week after downloading the sheet so the only way I have currently to find the date the report was fun is by the Server Time, if I can find the latest date in the Server Time column I can then grab that date and do my calculation based off that date and not new Date() which I perform below.
let selectedSheet = workbook.getActiveWorksheet();
let d: Date = new Date(); // Here I would like to be getting the latest date from Column A
d.setDate(d.getDate() - 28);
let date_string: String = d.toLocaleDateString();
selectedSheet.getAutoFilter().apply(selectedSheet.getAutoFilter().getRange(), 1, { filterOn: ExcelScript.FilterOn.custom, criterion1: "<" + date_string });
This is my first morning using office-scripts, from googling I am seeing it looks like I might have to grab the full column range and then filter it by newest-oldest and then take Cell A2 value ?
I can grab the full column range, but I could not find a way how to just setup a standard filter on newest-oldest.
Any help/direction and or links to beginner documentation would be really appreciated.
Thanks in Advance.
