PowerShell – Download Excel from SharePoint and Export to ServiceNow Tables

Sharing a PowerShell magic that I have written some time ago but forgot to share it with the community as it needs some modifications before it can be shared as generic solution.

During this holiday season, I got time to do these modifications and now sharing the solution.

Prerequisites for this solution:

Download the solution from below git hub link: (xlsheetspo2snow.ps1)

https://github.com/VikasSukhija/Downloads

Download the solution from PowerShell Gallery:

https://www.powershellgallery.com/packages/xlsheetspo2snow

Install-Script -Name xlsheetspo2snow

Update the below variables after downloading the Script.


$siteURL = ‘https Site URL’ #SharePoint online Site URL, do not include the aspx, just up to Site.

$folderurl = ‘/Shared Documents/General/xlsheetspo2snow’ #Folder location inside document library

$filename = ‘Master_Sheet_xlsheetspo2snow.xlsx’ # Excel File Name

$servicenow = ‘vikasprod.service-now.com’ #ServiceNow Instance Name for your environment

$sTable = ‘u_ws_master_request_imp_data’ #ServiceNow Instance Table

$logrecyclelimit = “60” #Log Recycle Limit

$smtpserver = ‘smtp.labtest.com’ #SMTP server

$from =’donotreply@labtest.com’ #From Address

$erroremail = ‘errorslogs@labtest.com’ #Error email address

Script will auto generate the password first time when it runs and will save it as encrypted in the same folder.


You can update the values for excel and table as per your environment.


You can schedule the script via task scheduler or as needed.

I hope this magic will guide you in your various integrations to servicenow.

 

 

Thanks for reading and downloading…

Tech Wizard

 

https://techwizard.cloud

https://syscloudpro.com/

PowerShell Fast Track

Leave a comment