I\'m experimenting with Blockspring which provides a Google Sheets add-on which can, for example, run a function which returns data from a webservice e.g.
=B
The flush() method can be used. Also see answers provided by others.
Documentation
SpreadsheetApp.flush();
Quote from the documentation:
Applies all pending Spreadsheet changes
If there were no changes to the spreadsheet, but you want to force formulas to recalculate, you will need to make a change, and then use SpreadsheetApp.flush();
For example, you could get the value from cell A1, then set the same value to cell A1. So, there is no chance of losing data because you are getting and setting the same value. The change allows. SpreadsheetApp.flush(); to recalculate all the formulas.
The documentation has some information on optimization: Google Sheets Custom Function Optimization