21 lines
850 B
PowerShell
21 lines
850 B
PowerShell
# Extract-StaffColumns.ps1
|
|
# Runs daily to extract PAYROLL_REC_NO, STAFF_STATUS, and E_MAIL from the staff export CSV
|
|
# --- Configuration ---
|
|
$SourceFile = "C:\Scripts\ASM\SF_5362.csv" # Update this path
|
|
$OutputDir = "C:\Scripts" # Update this path
|
|
$OutputFile = Join-Path $OutputDir "Staff_Extract.csv"
|
|
# --- Main ---
|
|
if (-not (Test-Path $SourceFile)) {
|
|
Write-Error "Source file not found: $SourceFile"
|
|
exit 1
|
|
}
|
|
if (-not (Test-Path $OutputDir)) {
|
|
New-Item -ItemType Directory -Path $OutputDir | Out-Null
|
|
}
|
|
Import-Csv -Path $SourceFile |
|
|
Select-Object PAYROLL_REC_NO, STAFF_STATUS, E_MAIL |
|
|
Export-Csv -Path $OutputFile -NoTypeInformation
|
|
# Remove all quotation marks from the output file
|
|
(Get-Content $OutputFile) -replace '"', '' | Set-Content $OutputFile
|
|
Write-Host "Export complete: $OutputFile"
|