Initial commit - Extract staff columns from ASM export

This commit is contained in:
2026-02-25 11:36:55 +11:00
parent 19d5a94f87
commit cd8ae59945

20
Extract-StaffColumns.ps1 Normal file
View File

@@ -0,0 +1,20 @@
# 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"