In order to copy the content in Spreadsheet cells, the Copy() method of CopyPaste property can be used. We already provided a user guide document to achieve this scenario and please make use of below code and UG.
//To perform copy operation for selected ranges
GridRangeInfo range = spreadsheet.ActiveGrid.SelectedRanges.ActiveRange;
Please get back to us, if you have any other queries.
SPSpottyJanuary 24, 2020 12:51 PM UTC
This assumes that I have manually selected the range and its active.
What if I want to select a range of cells programmatically but not make this visible to the UI.
The purpose is that I want to take data from the spreadsheet - copy it to another hidden sheet where I manipulate the data into a different format and then select the massaged data to copy to the clipboard.
So I really don't want to make the selection on the original spreadsheet obvious to the user.
Kanimozhi BharathiJanuary 27, 2020 09:12 AM UTC
You can achieve your requirement by making the copied range as GridRangeInfo type and pass it to Copy method of SpreadsheetCopyPaste class. Please find the code example for reference,