Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate the columns if empty #2241

Open
sbandaru08 opened this issue Mar 22, 2024 · 2 comments
Open

Eliminate the columns if empty #2241

sbandaru08 opened this issue Mar 22, 2024 · 2 comments
Labels

Comments

@sbandaru08
Copy link

Is your feature request related to a problem? Please describe.
Currently, when working with CSV files using CsvHelper, there isn't a built-in option to automatically eliminate or delete empty columns during the parsing process. This feature would be highly beneficial for users dealing with CSV files containing numerous columns, especially in scenarios where empty columns are not required for data processing or analysis.
Describe the solution you'd like
I would like to propose the addition of a configuration option or method within CsvHelper that allows users to specify whether empty columns should be eliminated during parsing.
Example:

var config = new CsvConfiguration(CultureInfo.InvariantCulture)
{
    SkipEmptyColumns = true // or similar configuration option
};

With this enhancement, CsvHelper would intelligently skip or remove empty columns while parsing CSV files, streamlining the data processing workflow and improving overall efficiency.

I believe that implementing this feature would significantly benefit CsvHelper users, making it a more versatile and powerful tool for CSV data manipulation.

Describe alternatives you've considered

Additional context
Add any other context or screenshots about the feature request here.

@JoshClose
Copy link
Owner

I don't understand. You only access the fields that you want to.

@mbdaso
Copy link

mbdaso commented Jun 29, 2024

You can use Optional() in your column mapping to ignore them if they are empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants