DWilliames / Google-sheets-content-sync-sketch-plugin

Sync content within a Google Sheets document, to text layers — based on their names. Edit and collaborate on your content in Google Sheets, then sync in back to your sketch files.
292 stars 24 forks source link

Alway require import URL #3

Closed leedat closed 7 years ago

leedat commented 7 years ago

Hi,

Thanks for you plugin. But we can not run it because it alway require import google sheet url. Please check it. My Sketch app's version is 44.1.

Thanks

DWilliames commented 7 years ago

Thanks @leedat. Sorry for the delay. I've made a couple of changes in a beta version, can you download this and see if it works: https://github.com/DWilliames/Google-sheets-content-sync-sketch-plugin/archive/develop.zip

If it's still not working, are you able to provide the publish link to your Google Sheet?

Regards.

leedat commented 7 years ago

Thanks your reply. But it were not fixed. Please check.

leedat commented 7 years ago

My public link https://docs.google.com/spreadsheets/d/e/2PACX-1vS4-SZ1_zwLU0GmyEt6f41NT2h_vGX7ySukP-hbeinT_TC_evU15yJ9NggjUZIqw79lBvUzvx5oBDFo/pubhtml Thanks

DWilliames commented 7 years ago

Thanks for that @leedat. It appears there is an issue with your URL — the typical behaviour it expects is for the url to be: https://docs.google.com/spreadsheets/d/[sheetID]/pubhtml

However yours has an additional /e/ in it for some reason. To extract the data from the sheet, I create a URL in the form... https://spreadsheets.google.com/feeds/list/[sheetID]/[sheetNumber]/public/values?alt=json Using the sheet ID obtained from the URL — but yours does not seem to work in this format.

Are you able to double check how you published the sheet? Try going 'File > Publish to Web > Stop publishing to web' — then republish it — 'publish' Can you see if it generates a URL without the /e/ after the /spreadsheets/d ?

Thanks.

xiaodoudou commented 7 years ago

Hey @DWilliames, the extra e is for Google Enterprise ;)

Cheers

xiaodoudou commented 7 years ago

Hey @DWilliames I have to dig a little bit the issue regarding why some user can't get the link established.

The issue is linked to Google Enterprise model. On my company, the security rule disallows public documents to be accessible to anonymous users; it means, if you go to the public URL it will prompt you a login and a password. The only solution that I have found, that your plugin follows Google standard of OAuth, then the user could use the private URL, then you will be able to reach the page thanks to it.

Here I totally understand that's a heavy change, but this way will solve all the issues of your users having trouble with their documents stored on a Google Enterprise account.

A bad workaround, if someone still wants to go that road, is to use a private google account with google drive. As you may bypass your company policies, you risk yourself to some other complications...

DWilliames commented 7 years ago

Awesome. Thanks for the explanation @xiaodoudou.

I have started looking into doing proper OAuth through the plugin — which would involve writing the plugin again from scratch. But I think this current Proof of Concept appears to have driven enough usage to make it worthwhile. I'll start looking into it further.

xiaodoudou commented 7 years ago

I was planning to use your plugin for the company I work for. Got to inspect your code to see what was going on. The fact that your parsing JSON catch doesn't throw an error, people don't get it doesn't work properly.

You should show a toast returning the error on a toast, like: "Failed to get the document data."

Also, the structure for me should be vertically described and not vertically inside the GSheet. I mean, as for a user doing copy, having a list from top to bottom is easier to deal with compare to left / right.

Good luck with the OAuth part, you can find nice documentation here: https://developers.google.com/api-client-library/javascript/features/authentication

DWilliames commented 7 years ago

Thanks again @xiaodoudou. I just made an update which adds the additional messaging on the JSON catch — and also some more URL validation.