Skip to content

adds optional parameter quoteEmptyFields#97

Open
blowfishlol wants to merge 1 commit intoryu1kn:masterfrom
blowfishlol:quote-empty-fields
Open

adds optional parameter quoteEmptyFields#97
blowfishlol wants to merge 1 commit intoryu1kn:masterfrom
blowfishlol:quote-empty-fields

Conversation

@blowfishlol
Copy link
Copy Markdown

@blowfishlol blowfishlol commented Apr 4, 2023

This pull request takes the input stated in issue #60

with this PR, createObjectCsvWriter and createArrayCsvWriter accepts the parameter quoteEmptyFields, and this will any cause empty (null/undefined) values to be given an empty double quote ("")

The reason we needed this is that our company is working on the finance sector and one of the specification for the generated CSV files is for the nullish fields to be given an empty quote (""), and this PR makes it possible to configure the CSV writer to write nullish values as ("")

So quoteEmptyFields together with the alwaysQuote param, with the input of:

["VALUE_A, "VALUE_B", undefined, null]

Will generate an output:

"VALUE_A","VALUE_B","",""\n

@steve1337
Copy link
Copy Markdown

steve1337 commented Apr 5, 2023

+1 this would be very useful

Full disclosure: The author of the MR and I work at the same company.

@steve1337
Copy link
Copy Markdown

@ryu1kn Is there anything else that should be done for this MR?

@karimabbes
Copy link
Copy Markdown

karimabbes commented Apr 17, 2023

+1 this would be indeed useful

@bahag-xvisnei
Copy link
Copy Markdown

bahag-xvisnei commented May 31, 2023

+1. I would like have this PR merged and released soon :-)
Is there a way to start using this today?

@csherman2828
Copy link
Copy Markdown

csherman2828 commented Feb 26, 2024

+1 I'd love to keep using this package but I needed this functionality and ultimately couldn't get it here. I'll have to look elsewhere. Love the interface but it's missing important functionality and contributor presence.

@brakmic
Copy link
Copy Markdown

brakmic commented Jul 15, 2024

Hi @blowfishlol ,

I’ve forked the CSV Writer project since the original seems abandoned. Your work on the quoteEmptyFields parameter is included in the fork.

Check it out here: CSV Writer Portable. You’re credited in the commit messages.

Thanks for your contribution!

Best,
Harris

@Tarabor
Copy link
Copy Markdown

Tarabor commented Nov 5, 2024

+1 please merge this PR soon!

1 similar comment
@ducpv-1644
Copy link
Copy Markdown

+1 please merge this PR soon!

@ducpv-1644
Copy link
Copy Markdown

@ryu1kn
+1 this would be indeed useful
please merge this PR soon!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants