How to distinguish between a Google Doc and Spreadsheet with the URL? - google-sheets

Is it possible to tell if a URL links to Google Sheets, Google Docs, or another Google app from the sharable link?
The app I am working on allows users to share links, but Safari on iOS devices doesn't seem to handle these links very well. To help ease our users pain, we would like to directly open the link in Sheets, Docs, or whatever other Google app works best, should it already be installed. I have been able to accomplish this by editing the link provided, replacing:
https://
with:
googledocs://
or:
googlesheets://
However, based on the sharable links, it's hard to tell if the link is a Google Doc, Google Sheet, or something else all together. I originally thought Google Sheets used sheets.google.com, but after testing out this change, I realized both Sheets and Docs use docs.google.com for their sharable links. If the wrong app is opened, Google Sheets or Docs will throw an error saying it cannot open the file.
Is there a simple way to make this distinction and ensure the appropriate Google app opens for any given sharable link?

Definitely not from the shareable link. The shareable link is basically just a redirect to the actual document. It's a hash that's generated independently from the original document that is intentionally obfuscated to prevent malicious parties from guessing them.
The only way to know what's on the other side of the link is to visit it or use the Google Drive API to query the document for info.

Related

Is there a way to collect Google IDs which access a Google Site?

I have created a Google Site which links to various Google Classrooms. I would like to know who is using the site.
Is there a way of recording the Google ID in a Google Sheet, for when someone accesses the site?
Any help or even a point in the right direction would be great.
Thanks
Ok, since you are using Google Sites, you can create a user start page by following these steps, this page will ask the users to authenticate with their emails, and will allow only users from the organizational unit for which the site is allowed.
After that step, you can use Google Analytics with your Site to track the behavior of users in your Site.
I suggest starting with a quickstart of Google Analytics to get the hang of it.
And soon enough you will have it set up to suit your needs.

POSTing to Google Sheets - Access Token

At the moment I have created two versions of my app - for iOS and Android - Where I use the OAuth workaround of posting to a Google Form to indirectly add to a Google Sheet.
However, I am now planning to remake the app in Google's Flutter (using Dart of course), and would prefer to use the proper direct way of POSTing to the sheet (it will simplify the situation for my client), but am having trouble trying to figure out how to do it.
I've found a simple explanation of how to to do the POSTing, but it requires an Access Token - what appears to just be a string.
After searching for an explanation of this, all I've found is explanations of how to create an OAuth token for the user using the app, but I just want to be able to post from within the app - totally separate from the user.
I guess I want a 'static' token that will just allow me to post to my sheet from my app indefinitely - is this possible, and can someone please explain it to me?
It sounds like you want to use what Google calls a service account for access to a sheet that belongs to your app rather than user's account for access to a sheet that belongs to a user.
https://developers.google.com/identity/protocols/OAuth2ServiceAccount

Codenameone Connect to Google Drive

This may be a dumb questions, but I haven't found an answer after lots of searching. I need to do two things, I need to allow my app to login to google, then save a file the users google drive.
I've found some steps on how to connect to google drive, but either its outdated or I don't have the correct libraries because it fails to compile: https://www.codenameone.com/google-login.html
Any help would be greatly appreciated.
For the login part there are good instructions in this blog post
Another sample of code to login to Google in this demo
You'll need to set the scope of the OAuth2 login to the appropriate Google Drive Scope
For saving files to drive, you should use ConnectionRequest to create the HTTP requests directly to their REST API.
Check the Integrating Google Sign-In into your web app. There's even an video guide explaining the concept.
There's a quick Save to Drive which enables your web site to allow users to save files to their Drive account from an arbitrary URL via their browser. If that's not sufficient enough, you can always check the Uploading Files where you can upload file data by creating or updating a File resource.

iOS, share webView content (long text or .pdf) via twitter and Facebook

Hello fellow developers,
I have some html loaded into a webview. I need to share its contents with twitter and Facebook, hence need to understand the following:
Is there a way to share long text to twitter? If that's not supported natively, maybe you are aware of some service that would accept some text and give me a link for that
I'm able to generate a .pdf from webview (following some article from this question How to convert html data to PDF in objective c) Are you aware of some service with iOS SDK that would accept a .pdf file and give me a link for that ? Having that you could simply share link via twitter.
I've spent some time googling both of those and at the moment the only idea is using dropbox, which kinda solves the case but provides not the best user experience since one would need to log-in to dropbox to enable the share functionality.
Looking forward to hear your thoughts.
--Dan
I recommend setting up a basic PHP service on your website (if you have one) to where you can upload the .PDF and then feed the returning link to an iOS API such as bit.ly's.
Their API will return a shortened link to the .PDF on your website and you can also track click counts with bit.ly
http://github.com/bitly/bitly_ios_sdk

Need Help Concerning iOS + Google Drive

What I want to do:
I need my ipad/iphone app to save files (image, pdf..etc) to a central google drive account
(note this app will be distributed to several clients, but all app will use same google drive account)
What I have done so far:
got hold of the google drive examples and sources
made a new test project, included the libraries required, build works fine
Problem:
All examples seem to use controlers/views to authenticate and use credentials from keychain.
In my case, I want to hardcode the email and password, do the authentication in the background and then push the files to Google Drive.
I have not found some good pointers or explanation as to how to achieve this and the sample code provided by google seems to be a whole mess..
I'm having a hard time to figure this out.
Well this seems to be quite impossible as the credentials and access token are obtained from the user always and the new Google Drive SDK does not support to what you want. And O-Auth will also not support you as its against their policy of User Data Protection.
You could try a call like this, following the same process as in the Google Example commenting out the part where the viewController is pushed to the front
[webView stringByEvaluatingJavaScriptFromString:#"document.getElementById('Email').value='ur.email#gmail.com';"];
[webView stringByEvaluatingJavaScriptFromString:#"document.getElementById('Passwd').value='urPass';"];
[webView stringByEvaluatingJavaScriptFromString:#"document.getElementById('signIn).click();"];
I glanced at the code for the google signin page and it gave these names for the text fields and for the "go" button

Resources