0

I get a small table into my sheet as query() result from huge database and can use these values in other formulas, copy them, etc. But I can't do the same thing using google apps script because it just can't read these values into my variables. I get #N/A or empty cells. My query function:

=query(IMPORTRANGE("[database link]";"'Database'!A3:AG1000000");"select Col23, Col24, Col25, Col26, Col28, Col29 WHERE Col22 contains '"&$C$3&"' ")

To check cells values I used this code:

var active_spread_sheet = SpreadsheetApp.getActiveSpreadsheet();
var active = active_spread_sheet.getSheetByName('Query result').getActiveCell().getValue();
Browser.msgBox(active);

Interesting thing: when I tried to copy first query() result using another query() function - after around a minute of loading I get the same result like my script reads cells values in first function. #N/A and empty spaces in the appropriate places.

  • Can you please provide a copy of your google Spreadsheet? What exactly is your problem? That you cannot read the output of your Browser.msgBox? Can you log the values with Logger.log? Do you get an error message and if yes - which one? – ziganotschka Jul 08 '19 at 10:39
  • 1
    This might help: https://stackoverflow.com/questions/51327982/using-bound-google-scripts-to-generate-a-query-object/51328419#51328419 – TheAddonDepot Jul 08 '19 at 12:03

0 Answers0