Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

reading excel files

$
0
0

I have this code:

$Read1=Import-Csv"U:\reports\ad\test.csv"
$GetDepartment=$Read1.Department
$GetDesc=$Read1.DepartmentDesc
$GetMail=$Read1.email
foreach ($emailin$GetMail) { $email.remove($email.indexof("@"))}
$email

it works and I can read the emails from the file.  I have 4 different records and emails in the file.  The output looks like this:

user1
user2
user3
user4
user4@acme.org

It adds the @acme.org on the last record each time.   Why?   I've tired adding single and double quotes around the record in Excel but that did not help.

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles