PC Review


Reply
Thread Tools Rate Thread

Converting text for csv

 
 
houghi
Guest
Posts: n/a
 
      4th Apr 2008
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.

 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      4th Apr 2008
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.

>

 
Reply With Quote
 
houghi
Guest
Posts: n/a
 
      4th Apr 2008
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting a date to a text field w/o converting it to a julian da LynnMinn Microsoft Excel Worksheet Functions 2 6th Mar 2008 03:43 PM
converting ASCII text to Microsoft Word text WhatAWriter Microsoft Word Document Management 1 7th Jan 2008 06:31 AM
Converting MS Word text to standard text for online application =?Utf-8?B?am9ubnllY2s=?= Microsoft Word Document Management 4 31st May 2006 05:41 AM
converting column of text to text box for repetitive records bilboda - ExcelForums.com Microsoft Excel Misc 3 15th Sep 2004 12:48 AM
Converting excel to text file - Issue with wrapping text giridar Microsoft Excel Misc 7 27th Aug 2004 06:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:42 AM.