Batch Excel To CSV Converter Application

I have been truly fascinated by the amount of visitors that I get because of the simple XLS/XLSX to CSV converter script that I made a while back (original post). For that reason I have created an HTML application (HTA) which offers the same functionality and then some:
XLS To CSV Converter
DOWNLOAD THIS APP

How this Differs from the Script

  • There is an easy to use interface.
  • You can customize how the resulting files are named.
  • You can filter which sheets will be exported as CSVs using simple text matches and/or regular expressions.
  • You will see the results of the conversion process in one place after the process is finished.

Using It

  • Download it from here.
  • Unzip the .HTA file.
  • Double-click on the .HTA file.
  • Click the Browse for Folder button and browse for the folder that contains the XLS and/or XLSX files whose worksheets should be exported as CSVs.
  • Modify the CSV Naming Schema as you like (hints are given in the application).
  • If you would like to only export worksheets with specific names, enter those names in the Sheet Filters textbox (only one per line). You may also use JavaScript-style regular expressions (one on each line) to match the sheets that you want to convert.
  • If you would like to remove the linefeed characters from all cells, check the appropriate checkbox.
  • Click the Start Conversion button and wait for the results to appear.

Version History

  • 1.0 – The first version.
  • 1.0.1
    • Fixed the error thrown when specifying a normal string as a “Sheet Filter”.
    • Fixed the copyright symbol in the “About” message box.
  • 1.1.0
    • Added the ability to specify the delimiter.

Plans for Improvement

As of right now this application is very simple, but I do hope to beef it up a little as time goes on. Let me know if you have any comments, questions, suggestions, or issues with this new application. Most of all, have fun!!! 😎

69 Replies to “Batch Excel To CSV Converter Application”

    1. I fixed the error and uploaded v1.0.1. Now you should be able to simply add a line with the name of the tab to the Sheet Filters in order to only convert that tab. Thanks for the feedback!

  1. This is just what I need to convert a directory of xls files BUT they are all password protected (with the same password) and your script reports 0 files converted. Is there any way you can support passwords?

  2. Thank you for this GREAT script! I would like to specifically EXCLUDE a couple of Sheet Names like Chart1, Macro1, etc. Can you help me figure out how to accomplish this?

    1. If you want to exclude all of the tabs named Chart# or Macro# you can use the following regular expression as your filter:
      /^(?!Macrod|Chartd)/i

      That will basically make sure that only the sheets (tabs) whose names don’t start with Macro followed by a digit or Chart followed by a digit will be converted. The lowercase “i” at the end signifies that casing is not important.

  3. Hi Chris,

    I have been looking for a tool like this for a while.
    However, for some reason I cannot really find what I need.
    Maybe you can help me.

    I need the XLS to be converted into:
    a. PIPE-delimited file
    b. UTF-8

    Do you think it is possible to offer this in your solution? (within a week or so)
    Especially the PIPE thing is hard.
    There are tools to convert to UTF-8 separately, but of course it would be ideal to do it all in one tool 🙂
    That would be awesome.

    Thanks in advance.

  4. It looks that regional settings have impact on selected delimiter:
    1. Select comma as a delimiter on English (United States) – comma will be used.
    2. Select comma as a delimiter on Dutch (Netherlands) – semi-colon will be used.

    Moreover the same happens when you use ‘Save As CSV’ option in Excel.

    Is there any way to force the tool to use the selected delimiter regardless of regional settings?

  5. Thanks for this app! It worked great to convert to tab delimited output for the two ‘regular’ xlsx workbooks in my folder. However, I have 300+ more ‘xlsm’ workbooks to convert in that same folder. The macros don’t matter, just need the text of the worksheets same as the ‘xlsx’ workbooks. Can the app also work with the sheets in a macro-enabled workbook? Thank you very much.

    1. Open the script and edit the foll. line

      var REGEXP_WORKBOOK = /([^\\\/]+)\.xlsx?$/i;
      

      to

      var REGEXP_WORKBOOK = /([^\\\/]+)\.xlsm?$/i;
      
  6. Hmm…If the workbook only contains one tab, it doesn’t seem to convert that one sheet to a csv? Should this be the case? It would be great if it did workbooks that only contain one tab as well since I can run an entire folder to batch convert all, regardless if the have one or multiple tabs.

  7. Sorry I should clarify that if the excel work book is of type XLTX (Excel Template) AND contains only one tab, then it does not appear to work. If the XLTX contains more than one tab, then it seems to work. Strange.

  8. Nice application,
    Is it possible to add a filter to select only columns you want to convert with check box or to select a range?

    Thanks

  9. This script has been very helpful. I converted 64 files in few minutes.
    Incase you converted and notice the conversion include empty sheets you didnt have any data on, just ignore and stick to sheet one, where most people put there data one.

    thanks again man. I really appreciate

  10. Chris,

    This is really a great, although I still stroggling a little with the Java Regular Expressions.
    Because the example didn’t work, so needed to search for some context about these RE.

    Maybe good idea to place somewhere list of examples of all kinds of usage settings, so not only RE but in combination with all options possible. Easy to pick an example or adapt by the person itself.
    Can we also use the filter string from the command line version (.js-code script) as a parameter for the script maybe?
    As I would like to use it in a batch process.

    For the rest a very handy and easy, light tool to get the job done!
    Keep improving as well….

  11. Great little app.
    It would be great if it could also automatically delete the xls file after conversion.
    Also would it take much to make this run automatically whenever an xls file is saved in the folder?

    Thanks,
    Phil

  12. I’m not sure if anyone else is encountering this issue (or I’m bad at following instructions), but I just want to convert a few sheets and whenever I type in a list of names (on separate lines as instructed), it only converts the LAST one from the list! is this perhaps a bug? Thanks in advance

    1. I found a workaround for this issue. The tool doesn’t accept certain characters in the sheet name, so put all the sheets that you want to be CSV-ed into the front of the XLS and then separate out the rest by inserting a sheet called “>” and the program will stop attempting to process the sheets once it gets to “>”.
      Once again, a great time saving tool!

  13. Nice! Would be nice to have progress feedback. I had a folder with about 25 spreadsheets that took a while and it just stared back at me 😉 In fact, displaying the console during the process would be just fine.

  14. Hi Chris,
    Thanks for this awesome tool.
    As some of the people mentioned above, I am working with files inside multiple subfolders (e.g. files are in folders data-01, data-02, data-03, data-04 … data-52 etc.), and right now I’m manually selecting each one.
    Is there any way to select all the folders in one go?

    Thank you.

  15. Great tool! How could I adjust the names of the files that are created to be the order that they appeared in? i.e. file 1 in the folder becomes 1.csv, file 2 becomes 2.csv etc?

    Thanks!

  16. When I double clicked the hta file it gave me this message: There is no application set to open the document “XLS to CSV Converter.hta”. Does this only work on Windows? Thanks!

  17. Thanks for your useful utility. Not sure where I ran across it but it was a link somebody had posted.

    Unfortunately I had a need to export some sheets in Unicode due to Arabic and Cyrillic characters in some cells. I have made what I think are suitable modifications and include the changes for your entertainment.

    Diff output (with left-angles replaced with left-brackets for blog posting):

    210,212c210
    [ var xlUnicodeText = 42; // Now saving in UNICODE text
    [
    [

    >
    428c426
    [ ? $id(‘radDelimTab’).checked || $id(‘radDelimTabUnicode’).checked

    > ? $id(‘radDelimTab’).checked
    506,507c504
    [ $id(‘radDelimTabUnicode’).checked ? xlUnicodeText :
    [ delimiter == ‘\t’ ? xlText : xlCSV, // FileFormat

    > delimiter == ‘\t’ ? xlText : xlCSV, // FileFormat
    629d625
    [ [input type=”radio” id=”radDelimTabUnicode” name=”delimiter” value=”tab” />[label for=”radDelimTabUnicode”>Tab/Unicode[/label>

    Feel free to incorporate, make changes, etc. while being aware that I don’t know Javascript at all — your extensive comments are thus also much appreciated! 🙂

  18. This was fantastic, easy and exactly what I needed. I write a weekly status report in Excel and it has four tabs. One of the tabs is a detailed work log where each row is a one-liner status (ie, “Wrote script for XXX that did YYY”) and a category of 1 Headline, 2 Major 3 Medium 4 Menial. It helps me make sure I understand what’s important for the week and what to bubble up.

    Where I needed help was how to extract just the headlines from a year’s worth of weekly files. Since your tool creates the worksheets as different files, it made it super easy!

    Combined with some command-line-fu, it was easy to get the list

    $ grep -h “1 – Headline” *work*csv | gawk -F’\t’ ‘{print $1}’ > headlines.txt

  19. Saved me tons of time – thanks. I needed it to be recursive, so I added the following at line 528 (right after the file loop) to make it so, in case anyone else needs it:

    for(var fc = new Enumerator(fldr.SubFolders); !fc.atEnd(); fc.moveNext())
    {
    $id('txtFolder').value = fc.item().Path;
    startConverting();
    }

  20. Thank you so much! This saved me a ton of work. I am writing a research paper and used your software to help organize my data. How should I cite you?

  21. I get an error dialog when attempting to run the program:

    Automation server can’t create object
    undefined

    What’s the work-around for this error?

  22. i am not open this program and I get an error dialog Restictions ” This Operations has ben Cancelled due to Restictions in effect on this computer “. I’ve done various ways with google but still can not. Is there any way to open it?

  23. Hello,

    I would like to know how many excel files i can convert to Csv at the same time? what is the maximum number?

Leave a Reply

Your email address will not be published. Required fields are marked *