convert XLS to CSV with charset convertion

  • Thread starter Thread starter Alain R.
  • Start date Start date
A

Alain R.

Hi,

I have an excel file with charset "windows-1250" and i would like to
convert it to CSV file with charset "UTF-8"

how can i do that ?

thanks a lot,

Al.
 
Alain,

Do you have Excel installed on the machine and are you running this in a
non-ASP.NET application? If so, then I would automate Excel to open up the
file, and then just call the SaveAs method on the workbook, specifying the
CSV file format.
 
Hi,

so yes, excel is installed on the computer and it should run under
C#.net program only.

for now, i did the following thing :
open an OLEDB connection to excel file and line by line save it to
another file format CSV.

and i would like to convert string (line) to UTF-8 before saving it to CSV.

Al.
 
Alain,

That seems pretty roundabout, and too much code that you have to put
together.

Why not just call this?

http://msdn2.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet.saveas(VS.80).aspx

Here is some more information on saving workbooks in Excel:

http://msdn2.microsoft.com/en-us/library/h1e33e36(VS.80).aspx

Note that you will want to set the FileFormat parameter to xlCSV. For
more information on file formats, check here:

http://msdn2.microsoft.com/en-us/library/microsoft.office.interop.excel.xlfileformat(VS.80).aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top