Skip to main content

CONVERT

Converts a number from one measurement system to another.

Syntax​

expression.CONVERT(arg1, arg2, arg3);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | numberThe value in the specified units to be converted.
arg2RequiredApiRange | ApiName | stringThe original measurement unit.
arg3RequiredApiRange | ApiName | stringThe units for the result.

Returns​

number

Example​

Switch measurements between different units in a spreadsheet.

// How do you change pounds to kilograms in a spreadsheet?

// Transform a value from one measurement standard to another in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.CONVERT(2, "Ibm", "kg"));