I have tried to use the following script from an old message on this board in Office 365 to open a new worksheet and name it with the current date. This code only opens a new sheet with the name "Sheetx" (x is increasing numbers). I would also like to be able to open the new sheet from a template and delete/hide the previous day's worksheet. Here is the code I am starting with:
function main(workbook: ExcelScript.Workbook) {
// Add a new worksheet
let sheet1 = workbook.addWorksheet();
let tracks = workbook.getWorksheet("Tracks");
// Paste range at Sheet1!A1 from Tracks!1:1048576
sheet1.getRange("A1")
.copyFrom(tracks.getRange("1:1048576"), ExcelScript.RangeCopyType.all, false, false);
// Rename worksheet to "November 5th"
let denumire: Date = new Date();
sheet1.setName(denumire.toISOString().slice(0, 10));
}
function main(workbook: ExcelScript.Workbook) {
// Add a new worksheet
let sheet1 = workbook.addWorksheet();
let tracks = workbook.getWorksheet("Tracks");
// Paste range at Sheet1!A1 from Tracks!1:1048576
sheet1.getRange("A1")
.copyFrom(tracks.getRange("1:1048576"), ExcelScript.RangeCopyType.all, false, false);
// Rename worksheet to "November 5th"
let denumire: Date = new Date();
sheet1.setName(denumire.toISOString().slice(0, 10));
}