Need help getting variables off a website, specifically a Google Spreadsheet


#1

1) Give a description of the problem
Need to get some variables from a Google Spreadsheet

I’ve published my google sheet to be public. I’m trying to scrape some numbers off the page. Everything I’ve found in my searches is only a partial help for one line of code. Does someone have an example of a working piston to get variables from a website?

This is the page I’m trying to use.
https://docs.google.com/spreadsheets/d/e/2PACX-1vSxXRXMEOGBuGweBgX9aUxzNO9k-WvZBDBOkgqrLOyO6K4FrCT8ZNjtdcpgY4xIODttPYRqXLSOLZBt/pubhtml?gid=527320590&single=true


#2

Not sure if you saw these. This is a simple way to access public google sheets data:

A few posts down in the same thread is how to use it in a piston:

No specific working piston examples I am aware of. Hope this helps.


#3

I did see that, but the 2nd step is

Then set the variable on WebCoRE with:
{$response.feed.entry.gsx$_cn6ca[0].$t}

and I don’t understand. Set what variable?


#4

Whatever variable you want to use. So say in your define you have:

string myData

then below

set variable myData={$response.feed.entry.gsx$_cn6ca[0].$t}

Here are the notes from the other post further explaining how to use this:

Just in case it wasn’t mention (apologize if I’m redundant with another) … but it seems that you can replace the “gsx$_cn6ca” with gsx$columntext … where columntext is the value of cell $A$1 in all lower case with spaces and non alpha numerics removed … this makes it very easy to locate your cell data:

so in general, assuming your table has headers and starts in $A$1, it’s:

$response.feed.entry.gsx$column-a1-text[row].$t

or specifically, if $A$1 contains “Title Two”, and you want contents of cell $A$3, it becomes:

$response.feed.entry.gsx$titletwo[2].$t

So you can use the title of the column in the spreadsheet to extract a specific value from the column. Hope this helps.