This is the code:
The error is:
Can anybody help
JavaScript:
function main(workbook: ExcelScript.Workbook) {
// Access the data sheet
let dataSheet = workbook.getWorksheet("Data");
// Access the form sheet
let formSheet = workbook.getWorksheet("TEF3202");
// Access the range containing form fields
let formRange = formSheet.getRange("A1:P107");
// Determine the last row with data in column A of the data sheet
let lastRowWithData = dataSheet.getUsedRange().getLastRow();
// Access the range containing data in the last row
let dataRange = dataSheet.getRange("A" + lastRowWithData + ":BE" + lastRowWithData);
console.log(dataRange.getAddress())
// Read data from the last row of the data sheet
let data = dataRange.getValues();
// Fill out the form fields
formRange.getCell(6, 3).setValue(data[0][11]); // Example: Location
formRange.getCell(6, 10).setValue(data[0][12]); // Example: ELR
// Repeat this for all form fields as necessary
// Iterate over the data
data.forEach(row => {
row.forEach(cell => {
// Check if the cell is blank
if (cell === "") {
console.log("This cell is blank.");
} else {
console.log("Cell value:", cell);
}
});
});
// Save the changes
// workbook.save();
}
The error is:
Code:
Line 15: Worksheet getRange: The argument is invalid or missing or has an incorrect format.
Can anybody help