Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Converting text for csv
Where can I find information on how to correctly export a file to csv,
so I can import it in MySQL correctly? I start with something like "Chaussée". When I export this to csv, I get "Chauss,e". What I would need is something like "Chaussée", because when I import that, I do get "Chaussée" back on my site. I could replace each "é" with "é", but that letter is not the only one and there might be letters added later that are not there now. Is there information on what to do exacly, or a script I could download that does this for me? -- houghi http://www.houghi.org My experience with SuSE Linux 9.1 The businessworld is like prison and M$ made everybody their bitch. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Converting text for csv
I get this with the code below : Chaussée
This is the custom code I give everybody who has problems with the Excel CSV save function. there are lots of problems with the way excel saves CSV files. This solution always seems to work. Sub WriteCSV() Const MyPath = "C:\temp\" Const WriteFileName = "text.csv" Const Delimiter = "," Const ForReading = 1, ForWriting = 2, ForAppending = 3 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 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 = "," & Cells(RowCount, ColCount) Else OutputLine = OutputLine & Delimiter & Cells(RowCount, ColCount) End If Next ColCount OutputLine = OutputLine & "," tswrite.writeline OutputLine Next RowCount tswrite.Close End Sub "houghi" wrote: Where can I find information on how to correctly export a file to csv, so I can import it in MySQL correctly? I start with something like "Chaussée". When I export this to csv, I get "Chauss,e". What I would need is something like "Chaussée", because when I import that, I do get "Chaussée" back on my site. I could replace each "é" with "é", but that letter is not the only one and there might be letters added later that are not there now. Is there information on what to do exacly, or a script I could download that does this for me? -- houghi http://www.houghi.org My experience with SuSE Linux 9.1 The businessworld is like prison and M$ made everybody their bitch. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Converting text for csv
Joel wrote:
I get this with the code below : Chaussée This is the custom code I give everybody who has problems with the Excel CSV save function. there are lots of problems with the way excel saves CSV files. This solution always seems to work. Thanks. I will try it on Monday when I am back at the office and have Excel available. houghi -- This space left blank intentionaly |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Converting a date to a text field w/o converting it to a julian da | Excel Worksheet Functions | |||
Converting Text | Excel Worksheet Functions | |||
Converting text??? | Excel Discussion (Misc queries) | |||
Converting Text to Number | Excel Discussion (Misc queries) | |||
converting numbers to text and prefill text field with 0's | Excel Discussion (Misc queries) |