IMPORTJSONAPI icon indicating copy to clipboard operation
IMPORTJSONAPI copied to clipboard

Multiple queries same cell

Open suporteskills opened this issue 5 years ago • 3 comments

Hi,

Is there any way to import multiple queries? That is, to add several IMPORTJSONAPI functions in the same cell and with different filters?

I need to return the following URLs:

https://api.xxxxx.com.br/v1/xxxx/Catalogo/18?&j= " https://api.xxxxx.com.br/v1/xxxx/Catalogo/20?&j= " https://api.xxxxx.com.br/v1/xxxx/Catalogo/25?&j= "

As you can see the code after the "/" is changed for each query, so I need to aggregate all of these queries in a single cell.

suporteskills avatar Oct 15 '20 14:10 suporteskills

No way to do this at the moment I'm afraid.

qeet avatar Oct 15 '20 19:10 qeet

For those who need it I managed to do it using the QUERY formula from Google Sheets.

Problem solved, thanks.

Here is an example:

=QUERY({IMPORTJSONAPI("https://api.xxxx.com.br/v1/CrossDocking/Catalogo/2?limit=4000&j="; "$.produtos[?(@.preco_normal>20)]";((CAMPOS_IMPORTJSONAPI));"headers={'token':'da363bf44XXXXXXXXXXdebdbe4788d2'}");IMPORTJSONAPI("https://api.xxxx.com.br/v1/CrossDocking/Catalogo/3?limit=4000&j=";"$.produtos[?(@.preco_normal>20)]";((CAMPOS_IMPORTJSONAPI));"headers={'token':'da363bf4445cXXXXXXXXXbdbe4788d2'}");IMPORTJSONAPI("https://api.xxxx.com.br/v1/CrossDocking/Catalogo/4?limit=4000&j=";"$.produtos[?(@.preco_normal>20)]";((CAMPOS_IMPORTJSONAPI));"headers={'token':'da363bf4445cdXXXXXXXXXXXXdbe4788d2'}");IMPORTJSONAPI("https://api.xxxx.com.br/v1/CrossDocking/Catalogo/14?limit=4000&j=";"$.produtos[?(@.preco_normal>20)]";((CAMPOS_IMPORTJSONAPI));"headers={'token':'da363bf4445cd95d4XXXXXXXXXXXXe4788d2'}");IMPORTJSONAPI("https://api.xxxx.com.br/v1/CrossDocking/Catalogo/18?limit=4000&j=";"$.produtos[?(@.preco_normal>20)]";((CAMPOS_IMPORTJSONAPI));"headers={'token':'da363bf4445cdXXXXXXXXXXXXXXXXX788d2'}");IMPORTJSONAPI("https://api.xxxx.com.br/v1/CrossDocking/Catalogo/23?limit=4000&j=";"$.produtos[?(@.preco_normal>20)]";((CAMPOS_IMPORTJSONAPI));"headers={'token':'da363bf4445cdXXXXXXXXXXXXXXbe4788d2'}");IMPORTJSONAPI("https://api.xxxx.com.br/v1/CrossDocking/Catalogo/19?limit=4000&j=";"$.produtos[?(@.preco_normal>20)]";((CAMPOS_IMPORTJSONAPI));"headers={'token':'da363bf4445cXXXXXXXXXXXdbe4788d2'}")};"SELECT * ")

suporteskills avatar Oct 16 '20 11:10 suporteskills

Well done and thanks for sharing the solution!

I will reopen this issue just so that it is easier for other people to find this info.

qeet avatar Oct 16 '20 13:10 qeet