occ-ai / obs-urlsource

OBS plugin to fetch data from a URL or file, connect to an API or AI service, parse responses and display text, image or audio on scene
https://obsproject.com/forum/resources/url-api-source-fetch-live-data-and-display-it-on-screen.1756/
GNU General Public License v2.0
130 stars 18 forks source link

Unable to return the the table correctly from response body #101

Closed lax24r closed 2 weeks ago

lax24r commented 2 weeks ago

I have the following table (B3:D5) in Google Sheets that I want to output using the OBS urlsource plugin:

image

The youtube video shows how to return a single cell, but not the whole table. Can you please assist? I'm wanting to end up with something like below: image

This is what I currently have set.

image

image

royshil commented 2 weeks ago

@lax24r thanks for reaching out

you can access the entire table via e.g. {{body.values}} so your template can be for example

<table>
    {% for row in body.values %}
        <tr>
            {% for value in row %}
                <td>{{ value }}</td>
            {% endfor %}
        </tr>
    {% endfor %}
</table>

or you can send various parts to different sources like {{body.values.0.0}} and select the OBS Text source to send it to

lax24r commented 2 weeks ago

Thanks for the quick response. I'm still a bit confused as to where I paste that code to get the entire table to output in the format I showed from my initial post (the blue background image). The JSON Path field doesn't allow a whole lot of code to be inserted.

lax24r commented 2 weeks ago

Think I've just figure it out :)

Thanks so much for your assistance, this plugin is wonderful.