[Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1747
  • Last Modified:

Powershell script to export list data into excel at a scheduled interval


I am looking for a powershell script that will export SP list data into a spreadsheet at regular intervals. How do I write script for this and how do I schedule this job? Please note that I want all the fields from the list to be exported.

Any help is appreciated.
  • 3
1 Solution
Jamie McAllister MVPArchitectCommented:
I would use Task Scheduler on a Windows Server to schedule this. It's great in terms of being easy to use, robust, and has a credentials store for the script to run under.

I don't have a script to hand, but the export part should be relatively easy. As for the spreadsheet formatting it's possible to write excel spreadsheets as XML (in the correct schema) which is the easiest option for powershell. I've done dynamic spreadsheet creation before in C#.

I'll have a look in the community to see if there are scripts to get you started.

One other possibility would be to use the same export to excel function you get from lists and libraries by somehow using one of the .iqy files in a scheduler. I'll have to look into this, as I speculate it might be possible.
Jamie McAllister MVPArchitectCommented:
Task Scheduler can be made to work like this;
Download excel from SP
But you'd have to put in a bit more work to make it slick and get around the security prompts by turning them off. Then a Macro to save the file somewhere. Perhaps faster than trying to code something though...
Jamie McAllister MVPArchitectCommented:
OK, here's some Powershell to get the data out of the list as CSV, which will be loadable by Excel;


Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now