How to export InfoPath form data to Excel or CSV

Updated 11 October 2026

Once InfoPath is gone, the quickest way to make an old form library useful again is often a spreadsheet: one row per form, one column per field, ready to filter, total or load into Power BI or a database. Every filled-in InfoPath form is an XML file, so you can do this for free with tools that come with Windows and Office.

One form: Excel's XML import

In Excel, choose Data → Get Data → From File → From XML and pick a form's .xml file. Power Query shows the form's structure as tables; expand the columns you need and load them. This is fine for looking at one form or designing a report, but it is clumsy for hundreds of files, and Power Query splits repeating tables into nested tables you have to expand by hand.

A whole folder: a free PowerShell script

This script reads every .xml form in a folder and its subfolders and writes one CSV row per form. Each column is a field, named by its path in the form, such as requester/name. Run it on the forms of one template at a time (one form library, or one content type), so the columns match. Save it as Export-FormData.ps1:

# Writes one CSV row per InfoPath form (.xml) in a folder: one column per field, named by its path in the form.
param([string]$Forms = ".", [string]$Out = ".\forms.csv")
$xhtml = "http://www.w3.org/1999/xhtml"
# Fields are elements with no data child elements; rich text fields hold XHTML, so their text is read as a whole
$fields = ".//*[namespace-uri() != '$xhtml'][not(*[namespace-uri() != '$xhtml'])]"
$rows = New-Object System.Collections.Generic.List[object]
$columns = New-Object System.Collections.Generic.List[string]
foreach ($file in Get-ChildItem -Path $Forms -Filter *.xml -Recurse) {
  $xml = New-Object System.Xml.XmlDocument
  try { $xml.Load($file.FullName) } catch { "Skipped $($file.FullName): not a valid XML file"; continue }
  $row = [ordered]@{ "_form" = $file.FullName }
  foreach ($node in $xml.DocumentElement.SelectNodes($fields)) {
    $path = @(); $n = $node
    while ($n -ne $xml.DocumentElement) { $path = ,$n.LocalName + $path; $n = $n.ParentNode }
    $key = $path -join "/"
    $value = $node.InnerText.Trim()
    # Attachments and pictures are long base64 text without spaces
    if ($value.Length -gt 200 -and $value -match '^[A-Za-z0-9+/\r\n]+={0,2}$') { $value = "[file or picture]" }
    # A field that repeats (rows of a repeating table) is joined into one cell
    if ($row.Contains($key)) { $row[$key] = $row[$key] + " | " + $value } else { $row[$key] = $value }
    if ($columns -notcontains $key) { $columns.Add($key) }
  }
  $rows.Add([pscustomobject]$row)
}
$rows | Select-Object (@("_form") + $columns) | Export-Csv -Path $Out -NoTypeInformation -Encoding UTF8
"Wrote $($rows.Count) forms to $Out"

Run it from PowerShell:

powershell -ExecutionPolicy Bypass -File .\Export-FormData.ps1 -Forms C:\Archive\Forms -Out C:\Archive\forms.csv

We tested it with Windows PowerShell 5.1 on Windows 11, on our own sample forms and on 30 publicly available InfoPath templates filled with sample data.

Opening the CSV in Excel

The file is UTF-8 with commas. If your Excel uses a semicolon as the list separator (common with Polish, German or French regional settings), double-clicking the file puts everything into one column. Use Data → From Text/CSV instead and choose the comma as the delimiter. Dates and numbers are written exactly as InfoPath stored them (for example 2026-03-02 and 1249.00), not in the format people saw on screen.

What the script doesn't do

  • Repeating tables. A field that repeats, such as the rows of an expenses table, ends up in one cell with values separated by |. That is enough to search, but not to total. For a proper table, each repeating group needs its own CSV with a link back to the form.
  • Attachments and pictures. Long base64 values are replaced with [file or picture]. To save the files themselves, see how to extract attachments from InfoPath forms.
  • Field labels. Columns use the field names from the form's schema, not the labels people saw on the form. Drop-downs filled from a SharePoint list hold the stored value, often an ID.
  • Rich text and attributes. A rich text field becomes plain text without its formatting and line breaks. Values stored as XML attributes rather than elements are not exported.
  • A copy of the form. The CSV is the data, not a record that looks like the original. See how to open InfoPath forms without InfoPath.

Data, tables and a PDF of every form in one run

XSN Archive Viewer writes the same kind of CSV, but with one file per repeating table (each row linked to its form and parent row), and in the same run makes a PDF of every form with its original layout and saves the attachments. Conversion runs on your PC; your forms are never uploaded.