Skip to content

Instantly share code, notes, and snippets.

@AScriver
Created October 7, 2022 18:23
Show Gist options
  • Select an option

  • Save AScriver/159f9afdce20e00b348d65d4e04c66f7 to your computer and use it in GitHub Desktop.

Select an option

Save AScriver/159f9afdce20e00b348d65d4e04c66f7 to your computer and use it in GitHub Desktop.

Revisions

  1. AScriver created this gist Oct 7, 2022.
    19 changes: 19 additions & 0 deletions csv2xlsx.bat
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    @if (@X)==(@Y) @end /* JScript comment
    @echo off
    if [%1]==[] (
    echo Drag and drop a CSV file onto this one!
    pause
    )
    cscript //E:JScript //nologo "%~f0" %*
    exit /b %errorlevel%
    @if (@X)==(@Y) @end JScript comment */

    var ARGS = WScript.Arguments;
    var objExcel = WScript.CreateObject("Excel.Application");
    var objWorkbook = objExcel.Workbooks.Open(ARGS.Item(0));

    objExcel.DisplayAlerts = false;
    objExcel.Visible = false;
    objWorkbook.SaveAs(ARGS.Item(1), 51);

    objExcel.Quit();