// Source directory path. U16String srcDir("SourceDirectory\\Excel\\"); // Output directory path. U16String outDir("OutputDirectory\\"); // Load the input Excel file Workbook workbook(srcDir + u"Sample1.xlsx"); // Get the first worksheet Worksheet worksheet = workbook.GetWorksheets().Get(0); // Copy Row worksheet.GetCells().CopyColumns(worksheet.GetCells(), 0, 6, 3); // Save the Excel file workbook.Save(outDir + u"CopyColumns_out.xlsx");