Error VLOOKUP in Offfice scripts

Andre Nijsten 20 Reputation points
2023-06-11T12:16:30.9266667+00:00

When I put the formula "VLOOKUP(A1;F1:G1;2;FALSE)" in an Excel Script (see below) I have got the error "

Line 4: Range setFormulaLocal: The argument is invalid, missing, or incorrectly formatted.

My Excel Script is:

function main(workbook: ExcelScript.Workbook) {
	let selectedSheet = workbook.getActiveWorksheet();
	// Set range B1 on selectedSheet
	selectedSheet.getRange("B1").setFormulaLocal("=VLOOKUP(A1,$F$1:$G$1,2,FALSE)");
}

Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 122.6K Reputation points
    2023-06-11T14:06:17.46+00:00

    Did you try setFormula instead of setFormulaLocal?

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.