I have several infopath forms. Which contain data. I need to resume some of them in a CSV file.

I think I can do it with powershell. Loop in the directory and get all files.

But to retrieve data, do I have to look at the XML ? and format data as I wish ?

1 Answer 1


Yes you need to read infopath xml forms using powershell and pick up the fields you are interested in and then write each form as a CSV record.

Useful resources,

To Read contents of XML, [xml]$books = Get-Content C:\fso\Books.XML



And the build the contents in a string.

Once you finish the XMl record then write it the CSV file,

Add-Content c:\scripts\test.csv "The IP XML form 1"


You may have to do this by looping forms in document library

  • FYI, when you extract XML from a Infopath From, take care about how you built your form. Else informations are really hard to retrieve !
    – Nico
    Jun 23, 2014 at 14:07
  • I came back with a problem. When I put my form file in $a (for example), then, I'm not able to retrieve every data/info, some stay in the from and I can't get them from my $a or even in XML. Any ideas ?
    – Nico
    Jun 27, 2014 at 14:20
  • I didnt get what you mean. You need to get the contents of your IP xml form into a temp. variable say $a, and then iterate it to pick up the data
    – stak
    Jun 30, 2014 at 10:38
  • I found a solution, a lil bit dirty, but it works. I download the XML file, then I get it (Get-Content), then I do my stuff, and finally, i delete the XML temp. file.
    – Nico
    Jun 30, 2014 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.