Shareoint Site Structure via Powershell and Excel

by bronyx85 at 2013-02-07 01:16:24


Can someone advise on how I can create a site structure in SP13 ONLINE site structure using a Excel spreadsheet.

i.e. my site structure is on the spreadsheet, so what I would like to do is tell powershell to look at the SpreadSheet and create the site collections, sites, lists and libraries which are on that spreadsheet.

Is that possible?

by DonJ at 2013-02-07 09:36:44
Reading information from an XLS isn’t impossible, but it can be pretty tricky. If you could export that to CSV, it becomes much easier - PowerShell has an Import-CSV command, and that’d let you get the data into the shell.

$sites = Import-CSV sites.csv
foreach ($site in $sites) {
# refer to CSV columns like this: $, $site.whatever, assuming
# “name” and “whatever” are columns from the CSV

You can then use the data to run whatever commands you need to.