ANYONE EXPORTING THERE .CSV FILE FROM...

User 364143 Photo


Guest
5,410 posts

Here is a macro to automate the process.

Save Excel File To Csv With Quotation Mark Data Delimeter?

You can use the macro below. change MyPath and WritefileName as required.

Sub WriteCSV()
Const MyPath = "C:\temp\"
Const WriteFileName = "text.csv"

Const Delimiter = ","
DQuote =
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

DQuote = chr(34)

Set fswrite = CreateObject("Scripting.FileSystemObject")
'open files
WritePathName = MyPath + WriteFileName
fswrite.CreateTextFile WritePathName
Set fwrite = fswrite.GetFile(WritePathName)
Set tswrite = fwrite.OpenAsTextStream(ForWriting, TristateUseDefault)

LastRow = Cells(Rows.Count, "A").End(xlUp).Row

For RowCount = 1 To LastRow
LastCol = Cells(RowCount, Columns.Count).End(xlToLeft).Column
For ColCount = 1 To LastCol
If ColCount = 1 Then
OutputLine = DQuote & Cells(RowCount, ColCount) & DQuote
Else
OutputLine = OutputLine & Delimiter & _
DQuote & Cells(RowCount, ColCount) & DQuote
End If
Next ColCount
OutputLine = OutputLine & ","
tswrite.writeline OutputLine
Next RowCount

tswrite.Close

Exit Sub
End Sub


http://thedailyreviewer.com/office/view/save-excel-file-to-csv-quotation-mark-data-delimeter-112841179
CoffeeCup... Yeah, they are the best!
User 2120893 Photo


Registered User
45 posts

You rock man!


I don't rock till someone says it works.

How about it David?

Did it work?

User 2062767 Photo


Registered User
166 posts

Scott Swedorski wrote:
The reason why is you could have one of those delimiters in any one of these fields:

-For price, weight etc, most countries outside of the USA use a comma instead of a decimal. So $1.00 would be $1,00

-For the long and short description , you may have a coma or semicolon in the description.

This issue also applies to many of the other fields as well. The "" around them allow us to parse the data accurately.


Not sure if I am missing something here but I it is still working my way for me.

I have just done an experiment. I opened my .csv (comma delimited) file in excel. Made some changes to prices as they were rounded off (no pence) So £20 changed to £20.45 & put a lot of ,s & ;s where they should'nt be - just to see what happened. Saved it & imported it into SCC pro. Everything was as it should be no problems.

Cawoodwilly wrote:
Have you tried to save as an excel file and then re open it and save as csv? I bet your formating will be gone.


I tried that as well - still no problems. Sorry. :P

I am really not boasting nothing usually goes my why. It is bound to come crashing down around me.

Just curious Scott, why have you got the comma (,) field option?
www.heylisflorist.co.uk - My Florist Shop.
www.woodentopstoys.co.uk - My Wooden Toy Shop.

I use CoffeeCup HTML Editor, WIS, Direct ftp, Sitemapper, Website Insite & RED Personal to create my websites.

Send your parcels with Despatch Bay! Signup using this code and get £10.00 worth of free shipping http://despatchbaypro.com/s/1H431
User 2120893 Photo


Registered User
45 posts

After being able to work on this a little. I find that the code I posted will not work if there are symbols such as - + / at the start of any cell. I use the - symbol at the start of my parent categories for looks. And it puts a triple quote when converted to csv. Which you can change to a single quote in notepad with the search and replace fuction before you upload. One other problem with this method is the import will try to promote the sub-cateories to parent.

The macro code that Tom posted needs to have an argument after the command DQuote = of something like "" or the word quote or the word none or any of many others. However, this code puts a trailing comma at the end of every row which SCCP don't like. I know of no way to remove the trailing comma other then by hand.

Something that needs to be noted is when importing a csv file into any program be it accounting software or a web store you have to put a full column in the last column on the right. If not done the csv file creation will delete all blank cells at the right side end of the row. All the way back to where there is a cell with something in it. In SCCP that is image4 which is empty in most webstores. So try moving either the sku or title columns to the end before creating the csv.

As I said I don't import to SCCP yet but after a few updates I'm sure I will. So I hope someone can help find an easy way to do this.
User 2120893 Photo


Registered User
45 posts

Sue Lister wrote:

I tried that as well - still no problems. Sorry. :P

I am really not boasting nothing usually goes my why. It is bound to come crashing down around me.



What that is going on is you are not saving your exported file to an excel work book is why you are able to edit it and re-upload.

Try this,

Export your store file and name it test.csv. Opened it in excel and "Save as" "Excel Work Book" not as a csv file. Then close excel and re-open the excel test file (not the one that has the lower case letter "a" on the icon. That is the csv file. Now save as csv. Then view it with notepad and you will see there are no quotes.
User 103173 Photo


VP of Software Development
0 posts

Just an FYI guys, we are going to be making some tweaks to the importing dialog so these quotation marks are not required. We will roll that out in the next update.

Thanks everyone for your input on this.
Learn the essentials with these quick tips for Responsive Site Designer, Responsive Email Designer, Foundation Framer, and the new Bootstrap Builder. You'll be making awesome, code-free responsive websites and newsletters like a boss.
User 289442 Photo


Registered User
161 posts

Well, I have followed this thread from the beginning and I must say, that for me, it is one of the most confusing I have followed on CoffeCup.

I no longer use Excel or any of the other office products. I have been using Open Office for some years. When you save a sheet in a Open Office spread sheet as a csv file you get the option of field separator and text delimiter. When the file is opened in any text editor the separators and the delimiters are all present. No mess, No error, No adding or subtracting elements.

The last time I used Excel was probably around 2003. I seem to think I remember you could do the same when saving a sheet over to csv then with Excel.

But the hairs get grayer and the memory dimmer:D
User 2118376 Photo


Registered User
43 posts

Scott Swedorski wrote:
Just an FYI guys, we are going to be making some tweaks to the importing dialog so these quotation marks are not required. We will roll that out in the next update.

Thanks everyone for your input on this.


Thanks Scott,

I will be looking for the roll out, instead of pulling my hair out. It will be easer to make sure I dont have a single comma in any of my description text then trying to add quote marks. You guys are the bomb!

Dave
User 289442 Photo


Registered User
161 posts

Scott Swedorski wrote:
Just an FYI guys, we are going to be making some tweaks to the importing dialog so these quotation marks are not required. We will roll that out in the next update.

Thanks everyone for your input on this.


Scott, then I guess it will be OK to use a comma or semi-colon in my title or description as long that is not the one being used as a field separator, or not? I'm interested to see how you accomplish that as the text delimiter is normally used for that purpose.

Standing by:)

TomH
User 103173 Photo


VP of Software Development
0 posts

TomH wrote:
Scott Swedorski wrote:
Just an FYI guys, we are going to be making some tweaks to the importing dialog so these quotation marks are not required. We will roll that out in the next update.

Thanks everyone for your input on this.


Scott, then I guess it will be OK to use a comma or semi-colon in my title or description as long that is not the one being used as a field separator, or not? I'm interested to see how you accomplish that as the text delimiter is normally used for that purpose.

Standing by:)

TomH

That is correct. We are also adding a pipe as a delimeter as well.
Learn the essentials with these quick tips for Responsive Site Designer, Responsive Email Designer, Foundation Framer, and the new Bootstrap Builder. You'll be making awesome, code-free responsive websites and newsletters like a boss.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.