Excel saving file as CSV with extra 2 commas at the end of the rows

mannyghee

New Member
Joined
Jun 16, 2011
Messages
11
I am working on a file with about 30K rows and has to be saved as a CSV file. When saved and opened up in NOTEPAD, the file has rows (starting with H) that have double commas (,,) at the end of the line while the others (start with D) are fine. The H rows are 2 columns less than the D rows. The added commas renders the file useless when imported into the application that needs it.

Below are screenshots of the Excel file and the CSV file opened in Notepad:

H
UNASSIGNED
Direct
0
BOTH
BOTH
DISPATCH #2
H
NO READ
Direct
0
BOTH
BOTH
DISPATCH #2
H
STD Super Sort Letters to LCTS 1
Direct
0
TRAY
BOTH
LCTS #1
D
1
1
780
780
0
9
0
9
D
2
2
780
780
0
9
0
9
D
18900
18900
0
0
0
9
0
9
D
18900
18900
171
171
0
9
0
9

<tbody>
</tbody>




H,UNASSIGNED,Direct,0,BOTH,BOTH,DISPATCH #2 ,,
H,NO READ,Direct,0,BOTH,BOTH,DISPATCH #2 ,,
H,STD Super Sort Letters to LCTS 1,Direct,0,TRAY,BOTH,LCTS #1 ,,
D,1,1,780,780,0,9,0,9
D,2,2,780,780,0,9,0,9
D,18900,18900,0,0,0,9,0,9
D,18900,18900,171,171,0,9,0,9
D,18900,18900,504,504,0,9,0,9
 
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I am working on a file with about 30K rows and has to be saved as a CSV file. When saved and opened up in NOTEPAD, the file has rows (starting with H) that have double commas (,,) at the end of the line

I suspect that Excel is doing nothing wrong. The two commas probably represent cells that contain some version of the null string. You might not even see them if the cell values had been created by someone doing copy-and-paste-value.

To confirm, verify that =ISTEXT(H1) returns TRUE, and =LEN(H1) returns zero.

Interesting workaround: save as CSV; close the window (or exit Excel); open the CSV file; then save as CSV again.
 
Upvote 0
Excel will always add the same amount of commas to all rows to match the largest row, I think that is the idea of a CSV file!

The workaround doesn't work around anything, there are still redundant commas stored in the CSV file.
 
Upvote 0

Forum statistics

Threads
1,214,407
Messages
6,119,332
Members
448,888
Latest member
Arle8907

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top