Hi There,
I'm wondering if anyone could help me
I have been tasked with getting all of our current product images into a folder
at the moment i have a excel spreadsheet with a list of the current images by product code (17153, 17154 etc) and i have to go through the directory manually searching for each image associated with the product ( 17153.jpg, 17153a.jpg, 17153b.jpg, 17154.jpg etc)
I am wondering if anyone would be so kind to out together a batch file that goes through the excel file cell by cell (column A) to then find the corresponding images (17153.jpg, 17153a.jpg, 17153b.jpg, etc) in the directory C:\ImageCleanUp and then place these image in C:\ImageCleanUp\Keep
Help if much appreciated
Regards
Jack
Need a Batch File
Moderator: DosItHelp
Re: Need a Batch File
Batch cannot directly access an excel file. You would need to export the data you need into a text file first.
Re: Need a Batch File
I think there was something like that, we converted xlsx file to a csv using vbscript then processed the CSV file instead.
Edit:
I found it, miskox posted this before, it convert xlsx files to csv.
You should provide a sample Xlsx file to test on.
Edit:
I found it, miskox posted this before, it convert xlsx files to csv.
You should provide a sample Xlsx file to test on.
Code: Select all
:XLS2CSV <xlsx_file> <csv_file_name>
IF not exist "excel2csv.vbs" (
(
echo Set objFSO = CreateObject^("Scripting.FileSystemObject"^)
echo src_file = objFSO.GetAbsolutePathName^(Wscript.Arguments.Item^(0^)^)
echo dest_file = objFSO.GetAbsolutePathName^(WScript.Arguments.Item^(1^)^)
echo Dim oExcel
echo Set oExcel = CreateObject^("Excel.Application"^)
echo oExcel.DisplayAlerts = FALSE
echo oExcel.Interactive = FALSE
echo Dim oBook
echo Set oBook = oExcel.Workbooks.Open^(src_file, 0 , TRUE^)
echo Set objWorksheet = oExcel.Worksheets^(1^)
echo objWorksheet.Activate
echo oBook.SaveAs dest_file, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, TRUE
echo oBook.Close False
echo Set objWorksheet = Nothing
echo set oBook = Nothing
echo oExcel.Quit
echo set oExcel = Nothing
)>>"excel2csv.vbs"
)
cscript /B excel2csv.vbs %1 %1.csv
goto :EOF