Converter

AppendTo

AppendTo writes converted output to the end of the target file. If the file does not exist, it is created. It is most useful when processing data in batches - the first batch establishes the file, subsequent batches grow it. Only the file overload is available for append; to append to a database, use SaveTo with an INSERT-configured database object.

WARNING

If the output format includes headers (CSV column names), they will be written again with each AppendTo call. Write headers once using SaveTo on the first call, then switch to AppendTo for subsequent calls - or use WithIgnoreFirstLineColumnNames on subsequent reads to suppress them.

Examples

GPAL Fluent: High-level fluent C# API

//AppendTo accepts the same plain file path string as SaveTo and RenderTo - it converts implicitly to GPALFile. The file path is resolved at the point of the call.

// Write first batch with SaveTo to establish the file

GPAL.Converter

.WithInput(batches[0])

.WithOutputType(DataFormat.CSV)

.SaveTo("output.csv");


// Append remaining batches

for (int i = 1; i < batches.Count; i++) {

GPAL.Converter

.WithInput(batches[i])

.WithOutputType(DataFormat.CSV)

.AppendTo("output.csv");

}

💬 Ask GPAL