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
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| arg1 | Required | ApiRange | ApiName | number | The value in the specified units to be converted. | |
| arg2 | Required | ApiRange | ApiName | string | The original measurement unit. | |
| arg3 | Required | ApiRange | ApiName | string | The units for the result. |
Returns
number
Example
This example shows how to convert a number from one measurement system to another.
- Code
- Result
// How to convert a number from one measurement system to another.
// Use function to convert a number from one measurement system to another.
let worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("A1").SetValue(func.CONVERT(2, "Ibm", "kg"));