Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to remove #TYPE System.String when converting to CSV ?

Posted on 2013-01-15
4
Medium Priority
?
2,312 Views
Last Modified: 2013-01-15
I have the following code:

Get-Content C:\scripts\AD\temp\UPI_OUv2.xlsx| ConvertTo-Csv > C:\scripts\AD\temp\UPI_OUv2.csv

Open in new window


How do i remove the #TYPE System.String in the CSV file ?

Thanks,
0
Comment
Question by:namerg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Expert Comment

by:David Carr
ID: 38780163
Try using Select-Object with the properties you want and Export-CSV instead of ConvertTo-CSV and add –NoTypeInformation

eg  | select property1,property2 | Export-Csv -Path C:\scripts\AD\temp\UPI_OUv2.csv –NoTypeInformation
0
 

Author Comment

by:namerg
ID: 38780240
And property1, property2 are the headers of the CSV file ?
0
 
LVL 9

Assisted Solution

by:David Carr
David Carr earned 1000 total points
ID: 38780286
Those would be the values that you want from the excel file. It is the -NoType Information that removes it from your CSV File

you might be able to get it with just Export-Csv -Path C:\scripts\AD\temp\UPI_OUv2.csv –NoTypeInformation

I do not have Excel files to test with at the moment
0
 
LVL 40

Accepted Solution

by:
Subsun earned 1000 total points
ID: 38780339
It you are trying to read xlsx file in PoweShell then you can use Import-Excel function as I mentioned in you other question..
http://podlisk.wordpress.com/2011/11/20/import-excel-spreadsheet-into-powershell/
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question