export powershell to excel document

You should try removing the format-table from your pipeline. It isn’t required when exporting to csv, and is only for displaying objects on screen.

You can rename properties in your select statement. If Extensionattribute6 is to be renamed to attrib6 you replace the property name in the select-object properties list with a hash table like @{“name”=“attrib6”;“expression”={$_.Extensionattribute6}}

Hope that helps.