Report Builder Export to CSV with Column Header Space

This is a strange query, as we all know that database headers should never contain spaces. However, the system I use requires importing spaces in its headers. I created a report builder report that creates data in a table and works when I run it.

'01/08/2015' "Active date", '31/07/2016' "Expiry date", 

However, when it is exported to a CSV file, they are replaced with "Active_date", which causes an import error. Does anyone know how I can stop it from replacing spaces _ or is it something that cannot be changed?

+1
source share
2 answers

Yes You can export to CSV with spaces in the column header. Here is how I did it.

Step 1
Update the report dataset to include the headers on line 1.

 SELECT * FROM ( SELECT Field1, Field2, 2 as rowOrder FROM Tables Where Conditions UNION ALL SELECT 'Activity Date' AS Field1, 'Expiry Date' AS Field2, 1 as rowOrder ) ORDER BY rowOrder 

Step 2:
Modify the RSReportServer.config file on the report server to configure CSV export to exclude the header.

2012 config file Location: C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer

2008 File Location: \Program Files\Microsoft SQL Server\MSSQL.n\Reporting Services\ReportServer

Imp: Make a backup of RSReportServer.config if you need to undo the changes.

Add another entry in the <render> section under the CSV extension.

 <Extension name="CSVNoHeader" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering"> <OverrideNames> <Name Language="en-US">CSV No Header</Name> </OverrideNames> <Configuration> <DeviceInfo> <NoHeader>true</NoHeader> </DeviceInfo> </Configuration> </Extension> 

Save it. Now you have another option to export down CSV No Header along with CSV, PDF, XML. Users can use this option to retrieve data in CSV with spaces in the header.

MSDN link to configure rendering extension

+1
source
-one
source

All Articles