Skip to main content

Copy

Copies the range to the specified range or to the clipboard.

Syntax​

expression.Copy(destination);

expression - A variable that represents a ApiRange class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
destinationOptionalApiRangeSpecifies the new range to which the specified range will be copied. If this argument is omitted, the range will be copied to the clipboard.

Returns​

This method doesn't return any data.

Example​

Copy a range of cells to another location in a spreadsheet.

// How do I duplicate a group of cells without retyping the content in a spreadsheet?

// Replicate cell content from one place to another without removing the original in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let range = worksheet.GetRange("A1");
range.SetValue("This is a sample text which is copied to the range A3.");
range.Copy(worksheet.GetRange("A3"));