After some time the formula breaks, and shows Error: Loading data..., and it won't work until I change anything in the parameters, e.g. Sheet1!a3:Ag to Sheet1!a3:AG, then it works for a few days, and then breaks again with the same error.

I've tried myImportrange custom function:

// to be used in the spreadsheet like ImportRange, 
// i.e. like this: =myImportRange( "key" ; "sheet!range" ; GoogleClock() )
// the third parameter - GoogleClock() - triggers an automatic update every minute.
// updated 2011-07-17 (ahab): better regex to strip sheetname of *outer* single quotes
function myImportRange(key ,sheetrange) { 
 var shra = sheetrange.split("!") ;
 if (shra.length==1) shra[1]=shra[0], shra[0]="";  

 var sheetstring = shra[0].replace( /^'(.*)'$/g , "$1") // was: replace( /'/g , "") ; updated 2011-07-17 (ahab)
 var rangestring = shra[1] 

 var source = SpreadsheetApp.openById( key )    
 if ( sheetstring.length==0 ) sheet = source.getSheets()[0] ;
 else sheet = source.getSheetByName( sheetstring ) ;

 return  sheet.getRange( rangestring ).getValues(); 

But eventually received the same error.

  • 1
    Yes, I am using new Google Sheets. But the formula =myIMPORTRANGE(...;GoogleClock()) worked for few weeks. Until now, that I get the same Error: Loading Data ... – Gleb Dec 3 '14 at 17:07

From Migrate to the New Google Sheets

Custom function arguments must be deterministic

Built-in spreadsheet functions that return a different result each time they calculate — such as NOW() or RAND() — are not allowed as arguments to a custom function in the new version of Sheets. If a custom function tries to return a value based on a volatile built-in function, it will display Loading... indefinitely.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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