GroupDocs.Merger for Java

Split CSV files

GroupDocs.Merger for Java enhances Java applications by adding advanced document processing features. Easily split CSV files and work with a variety of popular business formats.

How to split CSV files

With GroupDocs.Merger, you can split CSV documents and save selected pages as a new file. Integrate advanced document management into your Java applications.

  1. Provide the source path of the CSV file.
  2. Specify the output file path for the split document.
  3. Configure options for the split operation.
  4. Execute the split process and save the file.
// Load the source file into Merger
Merger merger = new Merger("document.csv");

// Define the output file path
String outPath = "result.csv";

// Set up split options
SplitOptions splitOptions = new SplitOptions(outPath, new int[] { 1 });

// Execute the split operation
merger.split(splitOptions);
Maven XML
click to copy
copied
More examples Documentation

Advanced document management

GroupDocs.Merger for Java offers a rich set of features for processing over 50 commonly used business file formats.

Key capabilities of GroupDocs.Merger

Merge different file formats

Combine PDFs, Word documents, presentations, spreadsheets, Visio diagrams, images, and archives. Customize the merging process for optimal results.

Organize document pages

Rearrange pages by moving, swapping, or deleting them to structure your documents efficiently.

Modify page layout

Rotate pages to any angle or switch between portrait and landscape orientations.

Extract pages as separate files

Select specific pages or a page range and save them as a new document in a chosen location.

Split CSV document and save even-numbered pages

This example demonstrates how to split a CSV document and save all even-numbered pages as a separate file.

Java

// Load the source file into the constructor
Merger merger = new Merger("document.csv");

// Specify the output file path
String outPath = "result.csv";

// Retrieve the total number of pages
IDocumentInfo info = merger.getDocumentInfo();
int lastPage = info.PageCount;

// Define split options for even-numbered pages
RangeMode rangeMode = RangeMode.EvenPages;
SplitOptions splitOptions = new SplitOptions(outPath, 1, lastPage, rangeMode);

// Execute the split operation and save the result
merger.split(splitOptions);
Maven XML
click to copy
copied
More examples Documentation

About GroupDocs.Merger

GroupDocs.Merger for Java is a powerful document processing library that supports over 50 file formats, including PDF, Word, Excel, PowerPoint, Visio, images, and archives. It enables merging, splitting, extracting, moving, swapping, and deleting pages, making document management more efficient.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Merger for free or get a trial license for full access!

Useful resources

Explore documentation, code samples, and community support to enhance your experience.

Key features

Discover the powerful document processing capabilities of our library.

Split various file formats

GroupDocs.Merger supports over 50 file types, enabling quick and flexible document modification.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English