0

While fetching the data from the excel through the PowerShell, along with that we are getting the column heading and datatype is "PSCustomObject". enter image description here enter image description here enter image description here enter image description here

so can any one help to remove the column heading as well as changing the datatype from PSCustomObject to String.

mklement0
  • 382,024
  • 64
  • 607
  • 775
  • In short: [`Select-Object`](https://docs.microsoft.com/powershell/module/microsoft.powershell.utility/select-object) (`select`) by default returns _a `[pscustomobject]` instance_ that has the _requested properties_ - even when you're only asking for a _single_ property. To get only that property's _value_, use the `-ExpandProperty` parameter instead of the (possibly positionally implied) `-Property` parameter. See the linked duplicate for details and alternatives, notably the ability to simply use `(...).SomeProperty` – mklement0 Mar 07 '23 at 13:40
  • In other words: `Select Name` -> `Select -ExpandProperty Name` – mklement0 Mar 07 '23 at 13:40
  • Please (also) post your code, data, error messages as ([properly formatted](https://stackoverflow.com/help/formatting)) _text_, [not (just) as _images_](https://meta.stackoverflow.com/a/285557/45375). – mklement0 Mar 07 '23 at 13:41
  • 1
    Working fine, Thank you, i will make sure that above format will be doing from the next time. – chandra_sekhar Mar 09 '23 at 12:56
  • Glad to hear it, and thanks for being willing to heed the formatting advice in the future. – mklement0 Mar 09 '23 at 14:47

0 Answers0