Accessing Google Sheets in Standalone – Inclusions needed?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by kaveh1000 » Thu Sep 26, 2019 9:53 am

Hi Richmond

First of all, you have solved my problem, with

Code: Select all

textdecode(...)
Thanks a million!

I am not using CSV because of the anomalies that you have come up with. I believe CSV is a terrible format, using a commonly used character (comma) to separate cells. For this it has to automatically put in quotation marks (but not always!) Then you get the problem of quotations that might occur inside cells. Then they have to be escaped!! Somehow I got JSON output to work and it does not have these problems.

Thanks again and I am watching this thread still. :-)
Kaveh

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9385
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by richmond62 » Thu Sep 26, 2019 11:59 am

On my way home for lunch I bumped into a professional programmer (the type who earns $20,000 a month)
and decided to be a pain-in-the-bum (surely not, Richmond?): he told me the reason I was probably having
difficulties with returns in dealing with .csv files was because I was importing
them as text files rather than binary files . . .

. . . unfortunately the fact that my wife is going to arrive any minute now exhausted from an early start and ravenously hungry
meant that I cooked her some lunch rather than experimenting with a binfile method.

So; this evening . . . 8)

Unfortunately kaveh1000 my brain has taken over (spent the night hallucinating about spreadsheets), so, while
the fact that you have solved your problem via JSON, I am still going to give .csv my best shot.
-
Screenshot 2019-09-26 at 14.01.48.png
Screenshot 2019-09-26 at 14.01.48.png (11.01 KiB) Viewed 5948 times
Last edited by richmond62 on Thu Sep 26, 2019 1:24 pm, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9385
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by richmond62 » Thu Sep 26, 2019 12:06 pm

I would, however, be extremely grateful if you could tell me (as well as sharing it
with all these folk who are watching my lunacy) how you got hold of a JSON
document from Google Sheets.

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by kaveh1000 » Thu Sep 26, 2019 12:11 pm

I had some great offline help from Thierry (author of sunnYrex), and somehow I managed to grab the JSON. Please see stack in this post:

https://forums.livecode.com/viewtopic.p ... on#p182782

I had to do some more massaging after that.
Kaveh

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9385
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by richmond62 » Thu Sep 26, 2019 12:12 pm

more massaging
Well; just so far as it only involves only massaging: I draw a line at whips and chains. :)

This looks "kinky", but may only work with MSOffice on Windows:

https://superuser.com/questions/1249898 ... -json-file

This seems more universal:

https://www.youtube.com/embed/HnFwl-8aT ... autoplay=1

mind you, it would involve the LiveCode stack sending some Javascript to the Google sheet . .
Last edited by richmond62 on Thu Sep 26, 2019 12:20 pm, edited 1 time in total.

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by kaveh1000 » Thu Sep 26, 2019 12:14 pm

:-) missing all the fun sire!
Kaveh

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9385
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by richmond62 » Fri Sep 27, 2019 9:45 am

What a b*mmer, my routine to strip cr chars from the data removes both the in-cell cr codes AND the ones that tells us to
move down a line in our spreadsheet.
-
Screenshot_20190927_114937.png
Attachments
HereItIs.zip
Here we go again.
(3.71 KiB) Downloaded 172 times
Last edited by richmond62 on Fri Sep 27, 2019 9:58 am, edited 1 time in total.

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by kaveh1000 » Fri Sep 27, 2019 9:58 am

sorry! But CSV is a horrible format and there is always a surprise lurking!
Kaveh

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9385
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by richmond62 » Fri Sep 27, 2019 10:30 am

CSV is a horrible format
So it seems.

However, you don't need to apologise as I do not hold you personally responsible for the CSV format. :D

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9385
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by richmond62 » Fri Sep 27, 2019 11:01 am

Screenshot_20190927_130033.png
Screenshot_20190927_130033.png (5.91 KiB) Viewed 5825 times
-
Hey-Ho: htmlText provides its own kind of fun.

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by kaveh1000 » Fri Sep 27, 2019 10:57 pm

Now you're really asking for trouble. ;-)
Kaveh

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9385
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by richmond62 » Sat Sep 28, 2019 6:22 am

asking for trouble
I dunno: I seem to have spent most of my life either getting into trouble
or causing other people trouble: so messing around with stuff coming out
of spreadsheets just feels like business as usual. 8)

"Nothing ventured, nothing gained."

AndyP
Posts: 615
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by AndyP » Sun Sep 29, 2019 4:24 pm

What about using a service like this?

https://sheetapi.co/

Turn Google Sheet into RESTful API's

They have a free option..
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9385
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by richmond62 » Sun Sep 29, 2019 4:33 pm

That's kinda groovy: but the original OP was asking about "sucking" something
directly from an open Google sheet into something in Livecode without any intermediate steps.

Also: that lot will start grabbing your moolah before you are halfway done.
-
2bucks.jpg
2bucks.jpg (14.12 KiB) Viewed 5699 times
-
Note my name is "right there." 8)
-
Far, far better to find a way without any intermediate steps, whether 'pay' or otherwise.

kaveh1000
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 508
Joined: Sun Dec 18, 2011 7:23 pm
Location: London
Contact:

Re: Accessing Google Sheets in Standalone – Inclusions needed?

Post by kaveh1000 » Sun Sep 29, 2019 4:44 pm

I agree with you Richmond. I am almost there with a solution. I am sorry this has split across two threads now, probably because I referred to the other one from here. See Bernd's response here:

https://forums.livecode.com/viewtopic.p ... on#p182782

textdecode worked for me as as Bernd said not all unicode chars are translated correctly. I have tried his method for converting \u2022 etc and almost all chars work.

If you have any comments on that I suggest you post in that thread.

Thanks to all for suggestions.

Kaveh
Kaveh

Post Reply

Return to “Talking LiveCode”