Issue with csv file

GPR

Board Regular
Joined
Jan 19, 2012
Messages
56
For work, need to save a csv file to be sent to customer. They upload into their system for invoicing.

For some reason, the csv I'm sending, they say is in the wrong format and fails when uploading into their system. After looking at the data, when you open the file with notepad, the text fields are not surrounded by double quotes. They say they should be in order for it to import into their system.

It's odd. New csv files I create, when I open in notepad, the fields are separated by commas, but no quotes. They sent me an example of a csv file that works. When I open that file it has the text fields in Double quotes. But number fields without quotes.

So my csv file when opened in notepad:

Code:
Company Name,Buyer Name,03/27/19,100.00,IL

Their csv file when opened in notepad (from my same computer):

Code:
"Company Name","Buyer Name","03/27/19",100.00,"IL"


Is there something I'm doing wrong here? I tried changing the formatting of the cells, no luck. I tried to insert the quotes directly into the excel document when saving it as csv, and the result is everything shows with triple quotes:

Code:
"""Company Name""","""Buyer Name""","""03/27/19""",100.00,"""IL"""

Currently using Excel 2013 if that matters.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
the save as option is very qwerky. I always use VBA to create the csv file.

Rich (BB code):
Sub Creat_Txt_File()
data = ""
myfile = "c:\results\test.csv"
If Dir(myfile) <> "" Then Kill myfile ' deletes file if it exists

For r = 2 To Cells(Rows.Count, "A").End(xlUp).Row
    lc = 5 'set last column
    For c = 1 To lc
    delim = ""
    If c < lc Then delim = "," 'do not add comma to cals column
    data = data & Cells(r, c) & delim
    Next c
    data = data & vbCr
    
Next r

Open myfile For Output As #1 
Print #1 , data
Close #1 

End Sub

hth,

ROss
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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