Reading data from Google Sheets
JJS
jjs at krutt.org
Thu Nov 15 14:06:38 EST 2018
i used this 3 years ago, found some examples and altered it a bit, still
works ok.
we used this to find info back on what others had added to the list.
you have to select the columns you want to read in the SELECT statement
in the script, you have to play with this
the script shows you that i used some buttons and fields
cardscript: (add your key!)
*local*sBrowserId
*function*browserId
*return*sBrowserId
*end*browserId
*on*browserBeforeNavigate pId, pUrl
*global*browserCancel
*if* "spreadsheets.google.com"isnotinpURL *then*
*answer*warning"Won't allow you to go to a domain outside this page!"
*put*trueintobrowserCancel
*end* *if*
*end*browserBeforeNavigate
*on*closeCard
*#if the hilite of btn "Browser ON" then*
*#unhilite btn "Browser ON"*
*#end if*
*#set the vScroll of fld "theText" to 0*
*pass*closeCard
*end*closeCard
*on*openCard
altBrowserOn
*pass*openCard
*end*openCard
*on*altBrowserOn
*local*tWinID
*put*thewindowidofthisstackintotWinID
*local*tBrowserId
*put*revBrowserOpen(tWinId,
"https://spreadsheets.google.com/tq?tqx=out:html&tq=SELECT%20A%2C%20B%2C%20C%2C%20I%2C%20J%2C%20K%2C%20L&key=YOURKEYGOESHERE&gid=0")
intotBrowserId
*if* tBrowserId isnotainteger*then*
*answer*"Failed to open browser: "& tBrowserId
*exit* altBrowserOn
*end* *if*
*put*tBrowserId intosBrowserId
revBrowserSet sBrowserId, "showborder", true
revBrowserSet sBrowserId, "rect", therectoffield"veld"
*end*altBrowserOn
*on*altBrowserOff
*if* sBrowserId isaninteger*then*
revBrowserClose sBrowserId
*end* *if*
*put*emptyintosBrowserId
*end*altBrowserOff
button refresh:
*on*mouseUp
*local*tBrowserId
*put*browserId() intotBrowserId
*if* tBrowserId isnotaninteger*then*
*exit* mouseUp
*end* *if*
revBrowserRefresh browserId()
*end*mouseUp
button to find something in the list:
*local*tVind
*on*mouseUp
*local*tBrowserId
*put*browserId() intotBrowserId
*if* tBrowserId isnotaninteger*then*
*exit* mouseUp
*end* *if*
*put*field"findthis"intotVind
revBrowserSet tBrowserId, "selected", tVind
*Put*emptyintofield"findthis"
*end*mouseUp
Op 15-11-2018 om 19:04 schreef dunbarxx via use-livecode:
> No good. Somewhere the last char of the text of a google sheet is inserted
> three times in the body of the html tag suite. So adding a delimiting char
> of any kind is futile.
>
> I still think I am overthinking this.
>
> Craig
>
>
>
> --
> Sent from: http://runtime-revolution.278305.n4.nabble.com/Revolution-User-f278306.html
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list