Maximize your protection, eliminate business risks.
Optimize and modernize with cloud transformation.
Empower your people to work securely from anywhere.
Let us handle IT so you can focus on growing your business.
Get multichannel 24/7/365 expert end-user support.
Protect, detect, and respond—Dataprise keeps your business secure.
Maximize uptime with with industry-leading DRaaS.
Swiftly mitigate cyber threats and restore security.
Improve efficiency, productivity and outcomes with cloud.
Ensure all mobile devices, everywhere, are secure.
Gain a competitive edge with strategic IT solutions.
This battle-tested checklist enables your team to swiftly initiate a ransomware response.
IT for businesses of all sizes, in any industry.
Empower institution growth with custom IT solutions.
Ensure your firm is always in compliance.
Improve patient care and staff morale.
Deal with pressing legal matters, not IT.
Keep up with the evolving digital landscape.
Focus on your mission by outsourcing IT.
Accelerate PE client deals and secure data.
Empower Your Municipality with Secure, Reliable IT Services
Execute initiatives and develop IT strategies.
Get the latest industry insights and trends.
Join us at events in person and online.
Hear from clients and learn more about strategic IT.
See how Dataprise can make IT your greatest asset.
Get informative technical resources from IT experts.
Stay on stop of emerging cybersecurity threats.
Discover the key areas of DR your organization needs to address to ensure downtime is minimized.
Gain a strategic asset by bringing harmony to IT.
Ensure 24/7 support and security with dedicated teams.
Drive business forward by partnering with Dataprise.
Meet our one-of-a-kind leadership team.
Discover the recognition Dataprise has earned.
Help us help businesses with strategic IT.
Grow through acquisition and partnership with Dataprise.
Embracing different perspectives and backgrounds.
Find a Dataprise location near you.
Dataprise is committed to empowering more women to consider a career in technology.
Explore our trusted partnerships with leading tech innovators.
Posts
By: Dataprise
Table of content
One of my favorite uses of SharePoint is to keep track of information that spans multiple departments, affecting each of us in different ways. I haven’t found a better tool that creates a central place where everyone can stay on the same page.
When we get a new sales order, most of that information needs to be uploaded to various SharePoint lists that keep track of our project execution, billing status, etc. At first, I entered each new sales order by hand into multiple SharePoint lists. It was a huge waste of manpower, and it ate up an enormous amount of my time. Naturally I thought there must be a way to automate this, so after many months of digging through documentation, I have found a relatively easy way to set up a script that will do these tasks for me.
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
(you must be an administrator for your site collection to do this)
$Username = “[email protected]”
$Password = Read-Host -Prompt “Please enter your password” -AsSecureString
$Site = “https://domain.sharepoint.com/sitename”
$Context = New-Object Microsoft.SharePoint.Client.ClientContext($Site)
$Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username,$Password)
$Context.Credentials = $Creds
$List = $Context.Web.Lists.GetByTitle(‘List Name’)
$Context.Load($List)
$Context.ExecuteQuery()
In our case, I’m uploading data from an excel file, so I need to open that file and get the data out of that file. The first piece of data I need is the client name, which is located on the first worksheet, in cell (1, F). This can be a little confusing because PowerShell needs two integers for the cell location. So what you have to do is replace the letters with numbers, starting with A = 1. This is not a simple translation, because if your sheet is large enough eventually you’ll get to the AA, AB, AC, sections and then what do you do? Just keep increasing the number. If Z = 26 then AA = 27, AB = 28, and so on. In the example below (1, F) is translated to (1, 6)
$filePath = Read-Host -Prompt “File path? ”
$objExcel = New-Object -ComObject Excel.Application
$workbook = $objExcel.Workbooks.Open($filePath)
$objExcel.Visible = $false
$sheet = $workbook.Sheets.Item(1)
$ClientName = $sheet.Cells.Item(1,6).text
$Title = $sheet.Cells.Item(2,6).text
After you get the information from excel put into variables, you can then upload that information to SharePoint
$listItemInfo = New-Object Microsoft.SharePoint.Client.ListItemCreationInformation
$newItem = $List.AddItem($listItemInfo)
$newItem[“Client_x0020_Name”] = $ClientName
$newItem[“Title”] = $Title
$newItem.Update()
You now have a new list item that contains the Client Name and Title from the excel spreadsheet
There are more advanced objects and other manipulations that you can do with SharePoint Online and PowerShell that will be coming in future blogs. I hope this helps you save a bit of time in your day.
Allison Sousa, PEI
INSIGHTS
Subscribe to our blog to learn about the latest IT trends and technology best practices.