Reading CSV Files from the Media Library with Sitecore Powershell Extension (SPE)

Some time ago I had a requirement while migrating site on different platform to Sitecore, to create bunch of redirects. Obvious approach here was to use Sitecore Powershell Extensions to accomplish this requirement. While solution is hosted on Azure and we do not have access to Kudu or App Service Editor I could not upload csv file without deployment. I came up with a solution to read file from Media Library. So here we go...

Csv file structure used in script:

1. SiteName,OldUrl,NewUrl,IsPermament 2. some name,some old url,some new url,1

Powershell script below: