excel office scripts documentation
async function main(context: Excel.RequestContext) {
// Get the cells at A1 and B1.
let dateRange = context.workbook.worksheets.getActiveWorksheet().getRange("A1");
let timeRange = context.workbook.worksheets.getActiveWorksheet().getRange("B1");
// Get the current date and time with the JavaScript Date object.
let date = new Date(Date.now());
// Add the date string to A1.
dateRange.values = [[date.toLocaleDateString()]];
// Add the time string to B1.
timeRange.values = [[date.toLocaleTimeString()]];
}