Initial commit - Extract staff columns from ASM export
This commit is contained in:
20
Extract-StaffColumns.ps1
Normal file
20
Extract-StaffColumns.ps1
Normal 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"
|
||||
Reference in New Issue
Block a user