While I get a file object from google drive api, I want to get the link to edit this file with google docs interface.
But as defined here, I only get the link to google docs if the drive.apps.readonly scope is set to readonly.
Is there any way to get this link for editing?
You should actually use drive.apps.readonly scope. "readonly" means that you cannot edit installed google apps, but you still can get list of these apps, and open any document for editing.
Related
Using API to get access_token and now I need to open Google Sheet.
Step 1.
Authorization: Bearer ya29.a0AV...." together with link: "https://docs.google.com/spreadsheets/u/0/d/[DocumentFileID]/edit"
Step 2.
Now HTML document back (~200kb). I'm using libcurl for that.
The problem is - missing are some css and js files and I see document just partially. Is there any way to open/edit Google Sheet using API?
I know for the option to just open https://docs.google.com/spreadsheets/u/0/d/[DocumentFileID]/edit in the new browser tab, but in that case I need to manually login to Google and that's what I try to avoid, because I want to use API to login and to open/edit a Sheet.
I also know for the option to share a document but I also try to avoid that. I'm writing application to customers who can access they own documents once they confirmed API usage.
I think you may have misunderstood what the google sheets api can do
The Google Sheets API is a RESTful interface that lets you read and modify a spreadsheet's data.
It gives you access to the data, it does not allow you to open the google sheets web application. Your going to have to code your own google sheets type app if you want users to open sheets directly.
I am stuck at getting the ID of the .docx file inside Google Docs Add-on.
The Id is present in the URL of the browser but I am unable to find any method to get the browser URL.
The method DocumentApp.getActiveDocument().getId() is not helping because it works on Google Docs file, and the file that I open in Google doc is Microsoft Word Format (.docx) file.
I am attaching a screenshot for reference: Reference image
Is there any way to get the ID of .docx file inside Google Docs Add-on?
Or is there any way to get the URL of the browser when the .docx is opened in the Google Docs Add-on?
Thanks in advance.
Answer:
There's no way to retrieve this information for non-Google Docs in Workspace add-ons.
Explanation:
As you mentioned, DocumentApp methods only work for Google Docs files.
Also, the Workspace add-on's Docs event object is only populated if the current document is a Google Docs. I just checked that's the case.
Finally, this information is not retrievable in the context of Workspace add-ons.
Feature request:
You could consider filing a feature request using this Issue Tracker template if you think this functionality could be useful.
Check out the event object for Workspace Addons using this link. When you build your card, you have access to the event. So you should be able to access it using docs.id within your function.
I open MS-Word file in Google Document and edit it. But changes wasn't reflected to original MS-Word file. Please tell me how to fix this. Is there any way through API?
I really liked your question, see if this helps :
you need to edit the file using the following two options
Edit the file using Office Compatibility Mode (OCM)
Convert the file to Google Docs, Sheets, or Slides.
For using the Office Compatibility Mode (OCM), do the following
Go to :
https://chrome.google.com/webstore/category/apps
Go to the Extensions "Menu"
Search for --> Office
Install the " Office Editing for Docs, Sheets & Slides" extension
Now go to Google Drive, there go to the settings
and uncheck the Convert Upload option
(Convert uploaded files to Google Docs editor format)
However if the doc is heavily formated, this may not be
a good way to edit it.
Ref: See the link below
https://www.youtube.com/watch?v=odjJBYpJmxs
I am sorry i didn't see the last part of your question where you have asked for API. I have not done this before ...
however ever when i check in the web,,i didn;t see any API like Google Docs API, I can see the Google Sheets and Google Slides API though in the RESTful APIs that Google is providing.
So Maybe can redesigning you app a little using Google Picker of Google Drive API, may help OR use the paid Google Apps for work https://apps.google.com/products/docs/
Some one else , in this forum may reply with better answer.
Is it possible to create a new Google Docs document, and then open it in the Google Docs editor? We have documents in our site that would be great to upload to Google Docs for editing but I'm having trouble figuring out if that's possible between the deprecated docs list API, and the new Google Drive API. Thanks.
Yes.
When you upload a file you will get back an item resource which contains a field AlternateLink. This is the edit URL.
To try it, go to https://developers.google.com/drive/v2/reference/files/get#try-it, click Oauth to On, then paste one of your file IDs into the fileId field. When you get back the item resource, just click the AlternateLink
I've noticed that some google drive apps fire POST request to https://docs.google.com/picker/drivepreopen?hostId=myhost upon file selection in picker dialog. Does anybody know what it does?
I need to be able to access my google docs files from my google drive app and I'm aware of the fact that drive apps can access only files it created or opened via context menu in google drive. As the name "drivepreopen" suggests maybe it allows you to programmatically invoke "open with"?
The Picker is how your app should be given access to a file and it can be used to display a list of the currently authenticated user's Drive files, as explained at https://developers.google.com/drive/integrate-open#open_files_using_the_google_picker.