Skip to content

ignoreColumns is not working #455

Open

Description

@onsightit

I occasionally get CSVs that have an extra comma on the header and rows. This results in the parser giving me unwanted columns, like 'field18'. I tried using the ignoreColumns option parameter like this:

		const converter = csv({
			noheader: false,
			ignoreColumns: /field\d+$/
		})

Or even hardcoding the column like this:

		const converter = csv({
			noheader: false,
			ignoreColumns: /field18/
		})

But it still gives me these unwanted columns. I suspect it is because 'field18' is not in the header. How can I get around this without deleting the trailing commas? I have an automated process, so manually editing the CSV is not an option.

Thanks!

Activity

  1. Kyaw-Zin-Thant commented on Dec 22, 2022

    @Kyaw-Zin-Thant

    I found the option to skip empty data columns, you can use ignoreEmpty.

    const converter = csv({ noheader: false, ignoreEmpty: true })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions