We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Interactively Copy a Range from a spreadsheet

Thread ID:





150909 Jan 24,2020 01:20 AM UTC Jan 27,2020 09:12 AM UTC WinForms 3
Tags: Spreadsheet
Asked On January 24, 2020 01:20 AM UTC

Im looking to select a specific range from a spreadsheet and copy the content so that it can be pasted into an Excel sheet

Preferably not show to make the selection visible but to copy it to the clipboard so its ready to paste into excel.

I know the rows/columns of the cells i need to select

Arulpriya Ramalingam [Syncfusion]
Replied On January 24, 2020 08:31 AM UTC

Hi Spotty, 
Thank you using Syncfusion products. 
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. 
Example code 
//To perform copy operation for selected ranges 
GridRangeInfo range = spreadsheet.ActiveGrid.SelectedRanges.ActiveRange; 
spreadsheet.CopyPaste.Copy(range, false); 
//To perform Copy operation 
Please get back to us, if you have any other queries. 

Replied On January 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 Bharathi [Syncfusion]
Replied On January 27, 2020 09:12 AM UTC

Hi Spotty, 
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, 
spreadsheet.WorkbookLoaded += Spreadsheet_WorkbookLoaded; 
private void Spreadsheet_WorkbookLoaded(object sender, WorkbookLoadedEventArgs args) 
  var range = GridRangeInfo.Cells(4, 5, 6, 6); //E4:F6 
  spreadsheet.CopyPaste.Copy(range, false); 
Please let me know if you need any clarifications. 
Kanimozhi B 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon