Aspose cells java copy worksheet without formats within workbook

Can you please provide sample code to copy a worksheet to another sheet with in same workbook without formats

@koteswaragunda,

You may create a range based on the whole data of the source sheet. Then, create the destination range (as per the source range) in the destination worksheet. Use Range.copyData() method to copy data (only) without formattings from source worksheet to destination worksheet. See the following sample code to accomplish your task for your reference.
e.g.,
Sample code:

// Instantiate a new Workbook.
Workbook workbook = new Workbook("d:\\files\\Bk_source1.xlsx");

// Get all the worksheets in the book.
WorksheetCollection worksheets = workbook.getWorksheets();

// Get the first worksheet in the worksheets collection.
Worksheet worksheet = workbook.getWorksheets().get(0);

// Create source range of cells based on whole dataset of the sheet
Range sourceRange = worksheet.getCells().getMaxDisplayRange();

// Get the destination worksheet
Worksheet worksheet2 = workbook.getWorksheets().get(1);

Range destRange = worksheet2.getCells().createRange(sourceRange.getAddress());
// Only copy data of the source range to  destination range
destRange.copyData(sourceRange);

// Save the Excel file
workbook.save("d:\\files\\output1.xlsx");

Also, see the document on copying ranges for your reference.

Hope, this helps a bit.

It helped. Thank you.

@koteswaragunda
You are welcome. If you have any questions, please feel free to contact us.