Within the realm of automation, PowerShell stands as a robust scripting language that empowers directors and builders to automate repetitive duties effectively. SharePoint, however, is a extensively used collaboration platform for doc administration and content material sharing. Combining the capabilities of PowerShell with SharePoint opens a plethora of prospects, together with the seamless synchronization of information from CSV recordsdata to SharePoint lists. On this weblog publish, I’m sharing a pattern script resolution that you would be able to make the most of to sync CSV or excel to SharePoint checklist.
- Create a SharePoint Record with identical columns as within the CSV file to make it easy.
Stipulations for this Answer:
https://www.powershellgallery.com/packages/PnP.PowerShell
Obtain the script from Git or PowerShell gallery from beneath hyperlinks:
Git:
https://github.com/VikasSukhija/Downloads
SyncCSV2SpoList.ps1
PowerShell Gallery:
https://www.powershellgallery.com/packages/SyncCSV2SpoList
Set up-Script -Title SyncCSV2SpoList
Replace the beneath part of the script with your individual parameters:
If CSV and SharePoint checklist columns aren’t identical, then you possibly can make the most of Choose-Object whereas importing CSV file to make it identical programmatically contained in the reminiscence. Replace the Script #######get checklist Objects Part######## as per your checklist columns ans fetch that in a set as proven within the pattern.
Script makes use of compare-object to seek out addition and removing of things requirement for SharePoint Record.
$addition
à objects will likely be added to SharePoint Record
$removing
à objects will likely be faraway from SharePoint checklist.
As all my scripts, this script additionally has a examine on threshold that’s depend of modifications to keep away from undesirable addition or removing.
Script will auto generate encrypted password first time it’s run and put it aside in the identical folder as proven in beneath screenshot.
On first run you possibly can modify the depend of modifications based mostly on what you expect and make it a big quantity like 5000 and so forth., on recurring runs or scheduled runs simply make it a smaller quantity like 50 that you simply anticipate as a each day change.
I hope you possibly can make the most of this resolution in loads of methods in your totally different automation wants.
Thanks for studying and downloading…
Tech Wizard