开发者

Consistent commas in Excel CSV

开发者 https://www.devze.com 2022-12-23 19:06 出处:网络
In Excel, let\'s say I have 5 columns, but not all of the time will a column have data. How can I force it to give a static number of commas?

In Excel, let's say I have 5 columns, but not all of the time will a column have data. How can I force it to give a static number of commas?

I end up having some rows like this (as I would like it):

Field1,field2,field3,field4,field5

field1,field2,,,

Then some rows l开发者_高级运维ike this:

field1,field2,field3,field4,field5,

field1,field2,

field1,field2,field3,field4,


you mean when exporting? That should happen by default. I tried it just now with Excel 2007 and all exported lines in the .csv-file had the same amount of commas. Those lines with fewer columns had extra commas at the end, just like in your example

Actual exported excel file:

hello;world;;;;
how;are;you;doing;;
hi;;;;;
welcome;to;;;;
the;jungle;;;;
some;line;with;lots;of;columns

The actual amount of commas is determined by the row with the most columns


So in this particular instance, there was a lot of copy pasting going on to create the file.

I finally opened a new worksheet, copied the entire document over, and created a CSV using that.

This resolved my problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号