?
Solved

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

Posted on 2013-01-15
4
Medium Priority
?
2,247 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

Ransomware Attacks Keeping You Up at Night?

Will your organization be ransomware's next victim?  The good news is that these attacks are predicable and therefore preventable. Learn more about how you can  stop a ransomware attacks before encryption takes place with our Ransomware Prevention Kit!

Question has a verified solution.

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

The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

771 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