File

File Configuration

Methods for configuring how GPAL reads a file - including the file path, delimiter, column names, header handling, quote behavior, and whether to overwrite on save.

Methods for configuring how GPAL reads a file - including the file path, delimiter, column names, header handling, quote behavior, and whether to overwrite on save.

WithFileName sets the path to the source file. WithDelimiter sets the character used to separate fields (default is comma for CSV). WithColumnName and WithColumnNames define the column headers for files that do not have a header row. WithFirstLineIsColumnNames tells GPAL that the first row contains column names. WithFieldsEnclosedInQuotes enables quoted field parsing. WithIgnoreFirstLineColumnNames skips the first row entirely. WithOverwriteFile controls whether GPAL overwrites an existing file when saving. WithUseSameColumnNamesForAllFiles applies the same column configuration to multiple files in a batch.

Examples

GPAL Fluent: High-level fluent C# API

//GPALFile is most commonly created via the GPAL.FileFor() shortcut, which accepts a file path string. Use GPAL.File (the full fluent builder) when you need to configure parsing behavior beyond just the path.

// Configure a CSV file with headers var file = GPAL.File .WithFileName("C:\data\customers.csv") .WithFirstLineIsColumnNames(true) .WithFieldsEnclosedInQuotes(true) .ToGPALObject(); // Configure a tab-delimited file without headers var tabFile = GPAL.File .WithFileName("C:\data\export.txt") .WithDelimiter(' ') .WithColumnNames("Id,Name,Email,Status") .ToGPALObject();