6

I have an XSLX file in a SP 2010 document library. I use the excel web access webpart to display it in a web page. However, if I modify the file, the changes are not immediately visible on the page. I need to explicitly reload the worksheet ( there is a item in the menu ) or wait a little ( like 15 minutes ).

It is possible to change this time or ( better ) making the changes appear automatically after a save ?

Thanks

1
  • I noticed that if I restart the browser, the web part shows the updated worksheet. In any case, I would prefer to be able to view the change by simple refreshing the browser.
    – castigli
    Commented Feb 1, 2012 at 6:10

3 Answers 3

4

It is the cache that is storing the previous version of the workbook in memory and therefore producing an out of date version. As you have already answered, the best way to prevent this is to reduce the cache configuration against the Excel Services application to its lowest value. This would be recommended for a development Sharepoint instance so that you can see your changes immediately and then leave the production environments with a healthy cache duration to benefit performance to the end users.

Another thing you can do is update the XLViewer.aspx file in your Templates\Layouts Sharepoint installation directory. From here, you can add a small javascript block to immediately refresh the connections of the Excel Services viewer so that the view is refreshed on every visit. I'd only recommend this in your development environment though as it will negate the benefit of the server caching.

Here's an example of using the Excel Services client side API to refresh the connections;

    <script>
            var jQueryScriptOutputted = false;

            function initJQuery() {
                //if the jQuery object isn't available
                if (typeof(jQuery) == 'undefined') {
                    if (! jQueryScriptOutputted) 
                    {
                        jQueryScriptOutputted = true;
                        document.write("<scr" + "ipt type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\"></scr" + "ipt>");
                    }
                    setTimeout("initJQuery()", 1000);
                } 
                else 
                {
                    $(document).ready(function() {
                        Ewa.EwaControl.add_applicationReady(SetupRefreshEwa);
                    });
                }
            }
            initJQuery();

            function SetupRefreshEwa()
            {
                om =Ewa.EwaControl.getInstances().getItem(0);
                om.getActiveWorkbook().refreshAllAsync(refreshAllAsyncCallBack); // automatically refresh all connections on open
            }
function refreshAllAsyncCallBack(asyncResult)
        {
            // Get the value from asyncResult if the asynchronous operation was successful.
            if (asyncResult.getCode() != 0)
            {
                 alert("Refresh operation failed with error message " + asyncResult.getDescription() + ".");
            }else{
                alert("Excel Analysis view refreshed on open");
            }
        } 
    </script>
1
  • Brian, I've just encountered this same issue myself. While I'm not very experienced with code-based solutions, this looks like a great fix for the issue, but as you mention, it negates the performance benefit of server caching. Is there, perhaps, a way to compare the Excel file's LastModified timestamp and that of the server cache, and refresh the connection only if this comparison determines that the cache is outdated? Commented Jun 21, 2015 at 20:35
2

The solution I found so far is to add an entry in Central Administration > Excel Services Application > Trusted File Locations for the worksheet.

I changed the two values called Session Timeout and Short Session Timeout ( expressed in seconds ). These two values are measured respect to idle time, i.e. if you have the page open but you're not editing the worksheet.

I was unable to put 0 ( this would disable the sessions ) since in that case the webpart would enter an infinite reload cycle, but by putting 1 I achieve the same effect and I don't need to close the browser to see the changes anymore.

2

The user has to reload the workbook in the browser without making changes.

As soon as the workbook is rendered in the browser,

Go to File and click Reload Workbook.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.