SSRS export to piped CSV

Reporting Services has a comma delimited export option. But what if you need to export a pipe delimited? The code below show’s you how to do this. Edit your rsreportserver.config file which can be found somewhere like C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer. (your MSSQL.3 may vary depending on where Reporting Services was installed)

Add the following code to the end of the Render section:
<Render>

<Extension Name=”PIPE” Type=”Microsoft.ReportingServices.Rendering.CsvRenderer.CsvReport,
Microsoft.ReportingServices.CsvRendering”>
  <OverrideNames>
      <Name Language=”en-US”>CSV (pipe delimited)</Name>
  </OverrideNames>
  <Configuration>
      <DeviceInfo>
          <FieldDelimiter>|</FieldDelimiter>
          <NoHeader>True</NoHeader>
      </DeviceInfo>
  </Configuration>
</Extension>


</Render>

In my case I didn’t want any table headers. You can look over the list of available options here:
http://msdn.microsoft.com/en-us/library/ms155365.aspx
If you want your file extension to be .txt instead of .csv then add this line in the DeviceInfo section: <Extension>txt</Extension>

Now you need to restart SSRS. In my experiences just restarting the service doesn’t force it to look at the config file for changes. I have to go into Reporting Services Configuration Manager and make a change within there for it to re-read the config file. I usually go to Email Settings and change the SMTP Server, hit apply, change it back, and hit apply again. Now click on Server Status, Stop, Start. Open up your report via the Reporting Services web page and you should now have a CSV (pipe delimited) export option!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s