// Create a new workbook Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); worksheet.getRange("H6:M7").setValue(1); worksheet.getRange("J9:J10").merge(); // set interior color for worksheet usedRange "H6:M10". IRange usedrange = worksheet.getUsedRange(); usedrange.getInterior().setColor(Color.GetLightBlue()); // Save to an excel file workbook.save("GetWorksheetUsedRange.xlsx");