@OdedDvir כתב בחיפוש תוכנה: המרת קובץ אקסל (xlsx) לcsv:
נחכה לשדרוג לגרסה 0.2 🙂
הנה גרסה 0.2 שדורשת רק שני קבצים (קרדיט ל-@dovid על ההערה)
סקריפט vb
if WScript.Arguments.Count <> 2 Then
Wscript.Echo "Error: invalid number of arguments specified." & vbNewline
WScript.Echo "Usage: ExcelCsvConvertor <InputFileName> <OutputFormat>" & vbNewline
WScript.Echo "Example: ExcelCsvConvertor input.xlsx csv"
Wscript.Quit
End If
InputFileName = Wscript.Arguments.Item(0)
OutputFormat = lcase(WScript.Arguments.Item(1))
Select Case OutputFormat
Case "csv"
XlFileFormatValue = 62
Case "xlsx"
XlFileFormatValue = 51
Case Else
Wscript.Echo "Unsupported output format specified: " & OutputFormat
Wscript.Quit
End select
With CreateObject("Scripting.FileSystemObject")
OutputFileName = .GetBaseName(InputFileName) & "." & OutputFormat
InputFileName = .GetAbsolutePathName(InputFileName)
OutputFileName = .GetParentFolderName(InputFileName) & "\" & OutputFileName
End With
WScript.Echo "Converting: " & InputFileName & " to " & OutputFormat & ": " & OutputFileName
With CreateObject("Excel.Application")
With .Workbooks.Open(InputFileName)
.SaveAs OutputFileName, XlFileFormatValue
.Close False
End With
.Quit
End With
קובץ התקנה
@echo off
set convertor_path=%~dp0ExcelCsvConvertor.vbs
cls
echo ==========================================================================
echo ExcelCsvConvertor: Context menu setup
echo ==========================================================================
echo.
echo [1] Install : Adds "Convert to CSV/Excel" options to context menu
echo [2] Uninstall : Removes "Convert to CSV/Excel" options from context menu
echo [Q] Quit
echo.
choice /C 12Q /T 1000 /D Q /N /M "Please select an option: "
IF [%errorlevel%]==[1] GOTO Install
IF [%errorlevel%]==[2] GOTO Uninstall
exit /b
:Install
echo Installing...
REG ADD HKEY_CLASSES_ROOT\SystemFileAssociations\.xlsx\shell\ConvertToCSV /f /d "Convert to CSV..."
REG ADD HKEY_CLASSES_ROOT\SystemFileAssociations\.xlsx\shell\ConvertToCSV\command /f /d "cscript /nologo \"%convertor_path%\" \"%%1\" csv"
REG ADD HKEY_CLASSES_ROOT\SystemFileAssociations\.csv\shell\ConvertToExcel /f /d "Convert to Excel..."
REG ADD HKEY_CLASSES_ROOT\SystemFileAssociations\.csv\shell\ConvertToExcel\command /f /d "cscript /nologo \"%convertor_path%\" \"%%1\" xlsx"
goto Done
:Uninstall
echo Uninstalling...
REG DELETE HKEY_CLASSES_ROOT\SystemFileAssociations\.xlsx\shell\ConvertToCSV /f
REG DELETE HKEY_CLASSES_ROOT\SystemFileAssociations\.csv\shell\ConvertToExcel /f
goto Done
:Done
echo Done!
pause
כל החבילה v0.2:
ExcelCsvConvertor.vbs
Setup (run as Administrator).cmd
@mekev הזריז הקדים אותי, אבל אני משאיר לו לשדרג את הפיצ'ר שלו לגרסה 0.3