Wednesday, January 22, 2014

SharePoint Site Custom Web Part SQL Report Viewer Export to Excel Error


"The file you are trying to open '<FileName.xls>', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file.

I faced this issue in QA environment for one of the SharePoint project where in there was a sql report rdlc file which was rendered in a report viewer control. When I try to Export to Excel the report it throws above error and when I click on Yes option to open the file it opens blank.
I could export the report to PDF and work that works absolutely fine but only the problem was with Export to Excel.

When I login with ADMIN account everything works fine, with admin account I could export the report to excel without any error.


There could be multiple reasons for the problem explained here, so not sure this solution will work for you but it worked great in my case.
  1.  Check the app pool account of the site where you are generating the report (say the app pool user account is: farmAppPoolUser
  2. Now browse the location:
  3. C:\Users\ farmAppPoolUser \AppData\Local\Temp 
  4. Add "Authenticated Users" to Temp directory with "Full Control" permissions.


1 comment:

  1. Excellent solution! This is really I- catching blog about how to export the SQL report to excel without any error login with Admin Account. I saw all the given links in your blog, these are really informative and descriptive. Thanks for sharing this solution with us. Keep it up.......