写一段BAT代码要求将多个excel文件合并为一个文件 文件路径为:CUsersMarcDesktopkey
@echo off set "outputFile=C:\Users\Marc\Desktop\key\merged.xlsx"
REM Create an empty temporary file echo. > temp.csv
REM Loop through each Excel file in the specified folder for %%f in (C:\Users\Marc\Desktop\key*.xlsx) do ( REM Convert each Excel file to CSV format echo Converting "%%f" to CSV format... "C:\Program Files\Microsoft Office\Office16\excel.exe" "%%f" /r /e /x "temp.csv"
REM Append the contents of the CSV file to the output file
echo Appending "%%f" to the output file...
type "temp.csv" >> "%outputFile%"
)
REM Delete the temporary file del temp.csv
echo All files merged successfully into "%outputFile%". paus
原文地址: http://www.cveoy.top/t/topic/hV1I 著作权归作者所有。请勿转载和采集!