I. Hola Jose Carlos, por mi parte sólo soy lector, pero con su permiso deseaba trasladarle la información que vi sobre su consulta por si pudiese serle de alguna utilidad mientras le atiende un experto de primera mano.
Lamento no saber atenderle mejor. Disculpe todas las molestias de lectura y el tipo de respuesta, ánimo y suerte.
https://stackoverflow.com/questions/26151021/how-to-save-as-txt-in-vba
https://gist-github-com.translate.goog/steve-jansen/7589478?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=es&_x_tr_pto=sc
https://www-mrexcel-com.translate.goog/board/threads/vba-code-to-convert-excel-to-text-file.281422/?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=es&_x_tr_pto=sc
https://stackoverflow-com.translate.goog/questions/67113569/vba-to-export-excel-cell-data-into-txt-files?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=es&_x_tr_pto=sc
https://stackoverflow.com/questions/46768426/vba-export-excel-sheet-to-a-txt-file
https://www.youtube.com/watch?v=bY7w4YJNyhw
Aportado por un usuario que utilizó ChatGPT
$csvFilePath = "C:\Path\To\Your\File.csv"
# Read the CSV file
$csvData = Import-Csv -Path $csvFilePath
# Get the headers from the CSV file
$headers = $csvData[0].PSObject.Properties.Name
# Initialize counters
$totalRows = 0
$uniqueEmployeeIDs = @{}
# Process each row in the CSV data
foreach ($row in $csvData) {
$totalRows++
# Get the value in the first column (employee ID)
$employeeID = $row.$($headers[0])
# Add the employee ID to the uniqueEmployeeIDs dictionary
$uniqueEmployeeIDs[$employeeID] = $null
}
# Count the unique employee IDs
$uniqueEmployeeIDCount = $uniqueEmployeeIDs.Count
# Output the results
Write-Host "Total Rows: $totalRows"
Write-Host "Unique Employee IDs: $uniqueEmployeeIDCount"