Solved

Excel (.XLS) to .CSV conversion

Posted on 2010-11-11
5
672 Views
Last Modified: 2012-05-10
Hello Experts,

I would like to have an excel macro which will do the conversion from XLS to UTF8 CSV file with No Byte Order Marker and no headings.

Can you please provide any sample macro or references for this?

Thanks a lot!
Shailesh
0
Comment
Question by:ShaileshShinde
  • 2
  • 2
5 Comments
 
LVL 6

Assisted Solution

by:nsonbaty
nsonbaty earned 167 total points
ID: 34109611
0
 
LVL 19

Assisted Solution

by:MINDSUPERB
MINDSUPERB earned 83 total points
ID: 34110459


Sub ConvertXLStoCSV()

    Dim strXLSFile As String
    Dim strCSVFile As String
   
    'Change Input and Output folders to relevant location
    Const strInputFolder As String = "C:\Temp\XLS\"
    Const strOutputFolder As String = "C:\Temp\CSV\"
   
    strXLSFile = Dir(strInputFolder & "*.xls")
   
    Do While strXLSFile <> ""
        strCSVFile = Left(strXLSFile, InStrRev(strXLSFile, ".")) & "csv"
        Workbooks.Open strInputFolder & strXLSFile
        ActiveWorkbook.SaveAs strOutputFolder & strCSVFile, xlCSV
        ActiveWorkbook.Close False
        strXLSFile = Dir
    Loop

End Sub


Replace the "C:\Temp\XLS\" and "C:\Temp\CSV\" with relevant folders.  Make sure you have a backslash at the end.

The macro will open every XLS file in the "Input Folder" and export them as CSV files to the "Export Folder".  It assumes that each workbook will contain only one sheet.  If you need to export multiple sheets to multiple files, it can be adapted to do so.

It doesn't test to see if the CSV file already exists and will probably prompt you to overwrite if it does.  Easier to delete the old CSV files from the Output folder first.

Source: http://forums.whirlpool.net.au/archive/565961

Sincerely,
Ed
0
 
LVL 1

Author Comment

by:ShaileshShinde
ID: 34116355
Hello Experts,

I ran the given macro on .XLS file which contains Chinese contents and found that this does not support for Asian characters and shows up ???.

Thanks,
Shailesh
0
 
LVL 6

Accepted Solution

by:
nsonbaty earned 167 total points
ID: 34129940
make sure that the OS and the office supporting asian characters, iinstall proofing tools, and chinees lang.. first
0
 
LVL 1

Author Closing Comment

by:ShaileshShinde
ID: 34147865
Thanks A Lot!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question