Solved

Excel (.XLS) to .CSV conversion

Posted on 2010-11-11
5
633 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now