-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support 1D- and 2D-arrays as input for URLs to allow usage inside ARRAYFORMULA #211
base: master
Are you sure you want to change the base?
Conversation
Hi, I believe this version also has the bottom row duplication problem, which I think was not the case for 1.5.0 (using that in one of my sheet and not duplication, tried 1.7.0 and it's there), wondering if it's possible for a fix? |
Hi, please provide example spreadsheet with the problem since I haven't seen any row duplication yet |
Hi, here is an issue regarding this problem Here is an example sheet I have made. |
This wasn't originally supported, I believe. The reason for "duplicate" is that you are trying to import whole JSON as a table when it's not a table, but contains a table (in "list" key) and there are other fields after the key with the table. Because of that the last row is first output as is and next time it is appended with the additional keys ("cursor" and "hasnext"). To get the table w/o non-table columns, pass the query as second parameter: |
yeah I chose that as an example since it's formatted that way. The interesting thing is when using 1.5.0, it loads just fine in my another private sheet, and it seems to be the case for other users too (in the issue linked). Using /list has it working just fine too. In any case, I also found this, which does seem to solve the duplication problem among some others, but has no support for array input yet. |
i accomplished something similar with /**
* Read list of URLs from range
* Ex1: ImportJSON_RASG("sheet9!C2:C7")
* Ex2: ImportJSON_RASG("myNamedRange")
*/
function ImportJSON_RASG(cellRange, query, parseOptions) {
var arr = [];
SpreadsheetApp.getActiveSheet().getRange(1,1).activate();
const arrURL = SpreadsheetApp.getActiveSheet().getRange(cellRange).getValues().join().split(',');
for (var url of arrURL) {
try { arr.push(ImportJSON(url, query, parseOptions)); }
catch { SpreadsheetApp.getActiveSpreadsheet().toast(url, 'Error fetching data', 3); }
}
return arr.flat();
} but your solution looks much better. |
This works now
=arrayformula(IMPORTJSON("https://www.binance.com/api/v3/ticker/price?symbol="&A2:B4&"", "/symbol,/price",))