Save a modern SharePoint list as a template

Save list as a template is one of the features that I miss the most on modern SharePoint, it was very handy to copy list definition and even to migrate lists with its content.

This functionality is not completely gone and with a few workarounds it’s still possible to bring it back however it’s not recommended to follow this path.

On this article I’ll explain you how to save a list as template on a communication or modern team site including lists with data.

Save a SharePoint list as a template

Before we get started you need to make sure you have PnP PowerShell installed on your machine, if you don’t instructions on how to install it are available here.

Save list as a template

To save a list as template you will need to do the following:

  1. Extract the PowerShell scripts from here
  2. Edit the saveListTemplate.ps1 file and update the variables at the top
    • $siteURL – site URL where your list is located
    • $listName – name of the list to save
    • $templateName – name of the template file
  3. Save the file
  4. Right click and select Execute with PowerShell
  5. Introduce your credentials and wait a few minutes, the execution time will depend of the size of your list
  6. Once the extraction process ends you will get an XML file next to the ps1 file

To save just a single list this script uses the cmdlet Get-PnPProvisioningTemplate with the parameters:

Get-PnPProvisioningTemplate -Handlers Lists -ListsToExtract $listName -Out ("{0}.xml" -f $templateName)
  • Handlers – to extract just the lists
  • ListsToExtract – to get just the desired list

By default, this cmdlet will only extract the list definition, to get data is necessary to use the cmdlet Add-PnPDataRowsToProvisioningTemplate. Any view customization you have added to the list will be also added into the template.

Add-PnPDataRowsToProvisioningTemplate -path ("{0}.xml" -f $templateName) -List $listName -Query ''

If you want to filter the data to extract you can build a custom CAML query in the Query parameter.

Apply list template

To apply the list template, you just need to apply the PnP template to your site, to do it follow the steps bellow:

  1. Edit the applyListTemplate.ps1 file and update the variables at the top
  2. Save the file
  3. Right click and select Execute with PowerShell
  4. Introduce your credentials and wait a few minutes, the execution time will depend of the size of your list


Lists with person fields are not supported by this method, if you get an error message like the one bellow you need to extract the content of your list without the person columns.

To do it you can use the cmdlet PnPDataRowsToProvisioningTemplate with the parameter Fields. You will need to manually define all the columns that you want to extract with data as shown in the example below.

Add-PnPDataRowsToProvisioningTemplate -Path template.pnp -List 'PnPTestList' -Query '' -Fields 'Title','Choice'

Download Scripts

Business vector created by pikisuperstar –

5 Responses to “Save a modern SharePoint list as a template”

  1. Cologne Claret

    September 16, 2019

    Hi Joao,

    thanks for the blog post and script :-).

    Another method for enabling the menus to work on templates can be found below:

    Once connected via powershell to SharePoint Online with admin rights to the site or O365 Group you can use the following to temporarily enable custom scripting.

    Set-SPOSite -Identity -DenyAddAndCustomizePages 0

    After this is done the site users will see the “save list as template” entry in the list settings and the “List templates” in the site settings.

    They can then save the list with or without contents. The new list then appears under Apps and can be found under the aforementioned “List templates” menu where it can be saved locally to be re-imported into any other site (once the above powershell command line has been executed on the target site.

    Set-SPOSite -Identity -DenyAddAndCustomizePages 1

    disables custom scripting again and removes the menus.

    We use this method to temporarily allow migration of lists before disabling again.



    Cologne Claret

  2. […] Save a modern SharePoint list as a template – Joao Ferreira (BindTuning) […]

  3. Zenktyo

    October 20, 2020

    Hello! Can’t find the link to mentioned scriprs: saveListTemplate.ps1, applyListTemplate.ps1. Could you please share them?

    • João Ferreira

      October 20, 2020


      Thanks for the heads up, I’ve just added a button to download the scripts to the bottom of the post.

      Have a nice day 🙂


Leave a Reply

I've been working with Microsoft Technologies over the last ten years, mainly focused on creating collaboration and productivity solutions that drive the adoption of Microsoft Modern Workplace.

%d bloggers like this: