Depending on the size of your dataset you may be able to use the Export-CSV command in powershell, getting to sftp requires another library though, something like WinScp.
The link to the DynamicPivot.cs file is broken, any chance you can update. Great idea by the way, how often do we need to do dynamic pivoting statements during the...