Exporting SSRS Report with Excel Formulas Preserved

Ahh Microsoft Excel, the key tool of every financial analyst across the world. Where would we be without you? What application would receive all of the notoriety for analysts mistakenly leaving in sensitive data in a hidden column? How would an analyst store tons of data that is a pain to mine?

As part of our conversion of some of our legacy Excel "systems" we have had to still produce Excel Reports. These reports have the strict requirement that when they are exported to Excel, they should still have the formulas so Analysts can do some scenario analysis. Lets ignore the analysis portion and get into the good old-fashioned coding part.

First, go ahead and read this article from SSRS books:

http://msdn.microsoft.com/en-us/library/ms159220%28SQL.90%29.aspx

 

Ok, did you read it? Was your question already answered? Awesome! Did you skip it and just want the answer here? Fine fine....

If you want the expression to export into Excel (so the user can play with the Excel spreadsheet and see values update dynamically) - you will need to set the field value to something like this:

=ReportItems!txtBox1.Value + ReportItems!txtBoxTwo.Value

See? that was fairly easy.

 

Some gotchas:

  1. Putting in a lot of formulas WILL make your report run slower/take much longer to render

  2. Make sure the cells are properly formatted (text, numeric, etc) before exporting as Excel can get confused.

  3. Always make sure your SSRS Server is patched and up-to-date!

This article is part of the GWB Archives. Original Author: ssrs

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.