Cycling through iframes and minimising loading

I have a sequence of embedded excel iframes that I would like to cycle through. Each iframe must be refreshed to show the latest data, but this takes several seconds. I have tried to run this in the background by refreshing the iframes in the background and waiting to display them, but I am quite new to javascript. Will this script perform correctly?

<script>
// Array of iframe IDs
var iframes = ['iframe1', 'iframe2', 'iframe3', 'iframe4','iframe5','iframe6','iframe7'];
var currentIframeIndex = 0;

function reloadAndSwitchIframes() {
    var currentIframe = document.getElementById(iframes[currentIframeIndex]);
    var nextIframeIndex = (currentIframeIndex + 1) % iframes.length;
    var futureIframeIndex = (currentIframeIndex + 2) % iframes.length;

    var nextIframe = document.getElementById(iframes[nextIframeIndex]);
    var futureIframe = document.getElementById(iframes[futureIframeIndex]);

    futureIframe.src = futureIframe.src; 

    currentIframe.style.display = 'none';
    nextIframe.style.display = 'block';

    
    currentIframeIndex = nextIframeIndex;
}

// Call reloadAndSwitchIframes function when page loads
window.onload = function() {
    setInterval(reloadAndSwitchIframes, 20000);
};
</script>