[BUG] Varying length of row and headers: false
Crusader4Christ opened this issue · comments
Herman Klushin commented
Describe the bug
Can't make csv file with varying length of row and headers: false.
var array = [
[1],
[1,2,3],
]
How can I save such structure to csv?
Also I need some way to save rows of varying length WITHOUT empty delimiters, to produce
1,2,3
1
from this array
var array = [
[1,2,3],
[1],
]
Parsing or Formatting?
- Formatting
- Parsing
Rishabh-C2FO commented
@Crusader4Christ : Hi Christ,
I have checked above issue and its working fine with latest version : 4.3.6.
Few Test Cases i have checked:
Case 1:
var array = [
[1],
[3, 4, 5],
[1,2,3],
[1,2, 3, 4]
]
writeToPath(path.resolve(__dirname, 'tmp.csv'), array)
.on('error', err => console.error(err))
.on('finish', () => console.log('Done writing.'));
tmp.csv data :
1
3,4,5
1,2,3
1,2,3,4
Case 2
var array = [
[1, 2, 3, 4, 5, 6, 7],
[3, 4, 5],
[1,2,3],
[1,2, 3, 4]
]
writeToPath(path.resolve(__dirname, 'tmp.csv'), array)
.on('error', err => console.error(err))
.on('finish', () => console.log('Done writing.'));
tmp.csv data:
1,2,3,4,5,6,7
3,4,5
1,2,3
1,2,3,4
Please let me know if you are still facing this issue or any specific case that is breaking.
Thanks