Converting xml to excel using powershell

Hi,

How to convert xml file into excel using powershell.i have tried some codes upto my knowledge but iam not getting the correct output.

  • Since XML can maintain multiple levels of depth and a CSV cannot, check you data.  That may be part of the problem.  Post some code for us to look at.

  • Post your code, explain your errors, show what you expect as the end results, or you are just leaving people to guess.

    Use the XML cmldets to import and parse the XML, download ad use one of the many XML modules from the MS PowerShellGallery.com, directly accessible form your PowerShell instance. XML and JSON are first class objects in PowerShell.


    Find-Module -Name '*xml*'| ft -a

    Version     Name                                   Repository Description                                                                      
    -------     ----                                   ---------- -----------                                                                      
    7.0         Xml                                    PSGallery  A module providing converters ...
    1.0.0.4     Power-XML                              PSGallery  Scripts to Build XML files                                                       
    1.0.1.1     XmlRpc                                 PSGallery  Module to interact with XML-RPC ...
    1.0         cEPRSXml                               PSGallery  cEPRSXml Module helps in managi...
    0.0.1       XmlContentDsc                          PSGallery  Module with DSC Resources fo...                          
    19.0.7052.0 XMLCmdlets                             PSGallery  CData Cmdlets for XML                                                            
    2.0.0.2     xXMLConfigFile                         PSGallery  This DSC module allows you to...
    1.0.6.357   Pubxml                                 PSGallery  Manipulate publishing profi...                                   
    0.0.2       LimeSurvey-Xml                         PSGallery  PowerShell module for L...                                 
    1.0         HumanTechSolutions.PowerShell.XmlUtils PSGallery  Some common XML Utils                                                            
    0.9.4       XmlEx                                  PSGallery  The XmlEx module implements...
    1.0.4       PSWordXml                              PSGallery  Module for creating Word...                               
    1.2.3       ImportXmlToSql                         PSGallery  Import xml to sql                                                                
    0.0.2       PSXmlRpcClient                         PSGallery  PSXmlRpcClient is an ...


    Using XML and JSON files wiht PowerShell is a very common thing adn well documented.

    See examples:

    Use PowerShell to Parse an XML File and Sort the Data
    https://devblogs.microsoft.com/scripting/use-powershell-to-parse-an-xml-file-and-sort-the-data/

    Powershell: Parsing XML part 1
    https://www.thomasmaurer.ch/2010/06/powershell-parsing-xml-part-1/

    Importing and Exporting CSV and XML Files in PowerShell
    https://www.itprotoday.com/powershell/importing-and-exporting-csv-and-xml-files-powershell


    And regulalry discussed...

    See examples:

    https://stackoverflow.com/questions/43393961/powershell-convert-xml-to-csv
    https://superuser.com/questions/1038868/convert-xml-to-csv-automatically-in-powershell