I am trying to get the date a row was modified inserted into a Modified Date column for that particular row using Office Scripts for Excel Online. This is the closest I can get since I haven't found scripts that that get just the modified row which will need to be dynamic. Details are in the comments in the code below:
function main(workbook: ExcelScript.Workbook) {
// This finds the location of the cell at K2 (Modified Date column is on K:K) but actually
//want to get the modified row location.
let datetimeRange = workbook.getWorksheet("Form1").getRange("K2");
// Get dynamic range of the worksheet. I'm not sure if this will work since there might be
//some blanks. The number of rows and possibly columns will change so needs to be dynamic.
let myRange =
workbook.getWorksheet("Form1").getRange("A1").getSurroundingRegion().getAddress();
// Get the current date and time with the JavaScript Date object.
let date = new Date(Date.now());
// This adds the date string to K2 but actually only want it added to Modified Date in the
//Modified Date column (dynamic since columns can change) for only the row that was modified.
datetimeRange.setValue(date.toLocaleDateString() + ' ' + date.toLocaleTimeString());
}