How to add a timestamp when moving the XLSX files to Archive? I only want to add it after it converts to a csv file and then when I am moving this to an archive folder.
Function ExcelToCsv ($File) {
$myDir = "\\emsfile1\Users Shared Folders\Woodgrain_PO_Automation\"
$excelFile = "$myDir\" + $File + ".xlsx"
$Excel = New-Object -ComObject Excel.Application
$wb = $Excel.Workbooks.Open($excelFile)
foreach ($ws in $wb.Worksheets) {
$ws.SaveAs("$myDir\" + $File + ".csv", 6)
}
$wb.Close($true)
$Excel.Quit()
}
$FileName = "Woodgrain_PO_Inbound"
ExcelToCsv -File $FileName
#Move files to XLSX Files to Archive
$file = "\\emsfile1\Users Shared Folders\Woodgrain_PO_Automation\*.xlsx"
$dest = "\\emsfile1\Users Shared Folders\Woodgrain_PO_Automation\Archive"
Move-Item $file -destination $dest -force