SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I import a CSV file to metadata service using PowerShell? The CSV file has 500 rows and seven levels in it (Importing of term store).

share|improve this question

This is the PS script I'm using:

    Param([string]$CentralAdminURL, [string]$TermsCSV, [string]$ADGroup)

    # loading the term store
    $site = Get-SPSite -Identity($CentralAdminURL)
    $session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession($site)
    $termstore = $session.TermStores[0]

    # Create a Taxonomy Group
    # I first create a Term Group
    $termGroup = "MY MM Group"
    $group = $termstore.CreateGroup($termGroup)
    # Import Taxonomy "Know How"
    # Create an instance of ImportManager
    $Importer = $termstore.GetImportManager()
    $varImported = ""
    $varMessages = ""
    $TermSetReader = [System.IO.File]::OpenText($TermsCSV)

    # Syntax: ImportTermSet(TermGroup, TextReader, out isImported, out errorMessage)
    $termset = $Importer.ImportTermSet($group ,$TermSetReader, ([REF] $varImported), ([REF] $varMessages))
    Write-Host $varMessages
    Write-Host $varImported

adapted from the original at

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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