Using Query JSON with SQL to grab Google Sheet Data

Hi there! I'm trying to call upon a google sheets query but the data isn't showing up appropriately. My goal will be to edit this query to join it with data I have in another query, but I can't get it to work without figuring out this step! (At least I couldn't get it to work and thought I'd need to come back to this step first. I've tried formatDataAsArray but it returned no rows (second screenshot).

Here's the google query:

I'd like to eventually do something like this:

Any help is greatly appreciated!

Hey Danielle!

In your case you would need something like this:

SELECT *
FROM {{bundle_expander_by_sku.data}}
WHERE component_sku=ANY({{ops_query.data.sku}})

Does this work?

It just says "No rows to display."

I can see, however, that there should be matches:

From oos_query:

From bundle_expander_by_sku:

I keep coming back to the way the data displays in the query without the "where" clause and maybe if I fix that I'd be able to move forward?

Thank you so much for the reply and any other help!

Perhaps it's due to it being case sensitive so if your query outputs COMPONENT_SKU it should be the same within the Query JSON with SQL.

SELECT *
FROM {{bundle_expander_by_sku.data}}
WHERE COMPONENT_SKU=ANY({{ops_query.data.sku}})

Does that change anything?

1 Like

Something close to your suggestion ended up working with an adjustment so it only shows those bundles affected when the sku is selected in the table! Thanks again for the help!

FROM {{bundle_expander_by_sku.data}}
WHERE COMPONENT_SKU={{OOSProductsTable.selectedRow.data.sku}}

@stefancvrkotic , thank you for your helpful answers in here!

Piggybacking on this question: how would I query specific columns?

I've tried different ways of using column names, be it select "Title"; select "col1"; select Col1; select col1, and even the below, but nothing seems to show up.

Do you have any help on this?

select {{ getdata.data.Title }}
from {{ getdata.data }}

Depends how the data is structured.

If getdata.data is object try

SELECT "Title"
FROM {{formatDataAsArray(getdata.data)}}

I tried that, and no dice. I'm sure it's just the fact I am a complete novice. Appreciate you being willing to take a look at this!


SELECT Title
FROM {{get_data.data}}

Should suffice, considering google sheets resource already returns an array (make sure there are no whitespaces in title header.

1 Like