Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8783285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:47:32+00:00 2026-06-13T20:47:32+00:00

I have multiple .xls files that I want to convert to csv files and

  • 0

I have multiple .xls files that I want to convert to csv files and already found this JavaScript:

/*
 jPaq - A fully customizable JavaScript/JScript library
 http://jpaq.org/

 Copyright (c) 2011 Christopher West
 Licensed under the MIT license.
 http://jpaq.org/license/

 Version: 1.0.6.000001
 Revised: April 6, 2011
*/
(function(){jPaq={toString:function(){return"jPaq - A fully customizable JavaScript/JScript library created by Christopher West."}};var e=new ActiveXObject("WScript.Shell");alert=function(a,b,c,d){a==null&&(a="");if(!b)b=WScript.ScriptName;c==null&&(c=alert.OKOnly+alert.Exclamation);d==null&&(d=0);return e.Popup(a,d,b,c)};alert.OKOnly=0;alert.OKCancel=1;alert.AbortRetryIgnore=2;alert.YesNoCancel=3;alert.YesNo=4;alert.RetryCancel=5;alert.Critical=16;alert.Question=32;alert.Exclamation=48;alert.Information=
64;alert.Timeout=-1;alert.OK=1;alert.Cancel=2;alert.Abort=3;alert.Retry=4;alert.Ignore=5;alert.Yes=6;alert.No=7})();
/***** END OF JPAQ *****/

try {
  // Create an instance of Excel, but don't allow the content
  // area to be repainted.
  var xlCSV = 6;
  var xlApp = new ActiveXObject("Excel.Application");
  xlApp.Visible = true;
  xlApp.ScreenUpdating = false;
  xlApp.DisplayAlerts = false;

  // Initialize the counts.
  var fileCount = 0, csvCount = 0;

  // Regular expression for match Excel files to be converted.
  var re = /([^\\\/]+)\.xlsx?$/i;

  // Reference the containing folder.
  var fso = new ActiveXObject("Scripting.FileSystemObject");
  var fldr = fso.GetFolder(WScript.ScriptFullName.replace(/[\\\/][^\\\/]+$/, ""));

  // Determine whether or not linefeed characters should be removed.
  var msg = "Would you like to remove linefeed characters from all cells?";
  var title = "Remove Linefeed Characters";
  var removeLf = alert.Yes == alert(msg, title, alert.YesNo + alert.Question);

  // Loop through all of the xls and xlsx files in this folder.
  for(var e = new Enumerator(fldr.Files); !e.atEnd(); e.moveNext()) {
    var aFile = e.item();
    if(re.test(aFile.Name)) {
      xlApp.StatusBar = "Processing " + aFile.Path + "...";

      // Open the workbook.
      var wb = xlApp.Workbooks.Open(aFile.Path);

      // Save each worksheet as a CSV file.
      for(var e2 = new Enumerator(wb.Sheets); !e2.atEnd(); e2.moveNext()) {
        var ws = e2.item();
        if(removeLf) {
          ws.UsedRange.Replace("\n", "");
        }
        var csvPath = aFile.Path.replace(re, function($0, $1) {
          return $1 + "-" + ws.Name + ".csv";
        });
        ws.SaveAs(csvPath, xlCSV);
        csvCount++;  // Increment the number of CSV's.
      }

      // Close the workbook.
      wb.Close();

      // Increment the number of files.
      fileCount++;
    }
  }

  // Allow alerts to be displayed, and the screen to be updated again.
  xlApp.DisplayAlerts = true;
  xlApp.ScreenUpdating = true;

  // Close Excel.
  xlApp.Quit();

  var msg = "The results are as follows:\nFiles converted:  "
    + fileCount + "\nCSV's created:  " + csvCount;
  var title = "Conversion Process Complete";
  alert(msg, title, alert.Information);
}
catch(e) {
  // If the Excel workbook is open, close it.
  try{ wb.Close(false); }catch(e2){}

  // If Excel is open, change the settings back to normal and close it.
  try{
    xlApp.DisplayAlerts = true;
    xlApp.ScreenUpdating = true;
    xlApp.Quit();
  } catch(e2){}

  // Print the error message.
  var msg = "The following error caused this script to fail:\n"
    + e.message;
  var title = "Critical Error Occurred";
  alert(msg, title, alert.Critical);
}

However, this code saves the files with comma-separation, not with semicolons.
As it seems, I have to save the files with my local settings (They are saved with semicolons when I save them manually via Excel) and I have no idea how…

Does anyone know a parameter for the

ws.SaveAs(csvPath, xlCSV);

method, so it will use my local settings?

I’d be very grateful for your help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:47:34+00:00Added an answer on June 13, 2026 at 8:47 pm

    I’m glad you found my post helpful. Unfortunately it seems that the only way to do this is to actually change the local settings of your system via the Control Panel. I determined this after many searches. Here is a page which states this fact. Please let us know if you find another solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple excel files which I open as datatable I want to merge
I have multiple arrays in javascript and I want to do sum of those
I have multiple tool bars that are all next too each other. I want
I have multiple ajax requests with javascript code as response, and I need to
I have multiple forms for lots of products on my page and want to
I have multiple domains on my server. I want to redirect all of them
I have multiple arrays with string values and I want to compare them and
Does anyone here know of any quick, clean way to convert csv files to
I have a Classic ASP script that outputs an HTML table as an XLS
I have multiple css files in a directory (style0.css, style1.css etc..) How can I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.