I'd like to open a PDF in Google Docs (not the previewer) without having Docs convert the file, 3rd Party PDF Viewers are not an option as I need to run a Google Script on the file also. PDF->Doc conversion is completely useless, as it removes all formatting and leaves a worthless document in it's wake.
No, there is not. Google Apps script DocumentApp can only work with Google Docs type files anyway.
Depending on what you are trying to accomplish you could look at the DriveApp Apis, but any modifications to the Document contents require it to be a google type file.
Related
Is it possible to remove the version history in Google Doc or Google sheet without duplicating the file. App Script solutions are also welcome.
You can use the Google Drive API to remove one or more revisions of a file. However, this method can only work with files that have binary content, not native Google formats.
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.
Using the HTML (div to load plusone.js) approach, is it possible to set the MIME Type of the generated Google Drive file?
Background
I'm trying to download CSV documents into Google Drive. I want customers to be able to open these files in Google Sheets with just a single click. Google Drive does not associate .csv files with Google Sheets automatically which means customers have to click here and there before they get the documents to open (not so good for my business).
I tried serving the documents with Google Sheets custom MIME Type application/vnd.google-apps.spreadsheet but it seems Drive completely ignores it.
If manipulating MIME Types won't work, I'll like to know any other means of associating generated files with Google Sheets such that customers can open generated documents automatically with a single click.
NB: I know its possible to set MIME Types in the Javascript and server-side flows using the Drive API and I have experience with the Drive API so please lets skip that :) I just want to get this done in the HTML flow.
Thanks.
Turn on conversion during uploads with convert parameter.
POST https://www.googleapis.com/upload/drive/v2/files?uploadType=media&convert=true
I'm writing some script for my Documents, Spreadsheets and Gmail. I would like to know if there is a way to save all my script to separate files in a specific google drive folder. I don't like having to go to the backend of my Documents and Spreadsheets in order to edit my script.
Would I have to call the document from my script using "getByID" or is there another way?
Yes, when you create a new document in Drive you can select Script. If you don't see the script option, try going here.
You will, however, need to call your document using getByID. There my be other complexities if you are using onEdit type triggers.
A lot more information can be found under the Types of Scripts heading at Google Apps Scripts Documentation.
You could go advanced and pull your script in behind the Document as a Library and then using the script behind the Doc to make the calls to the library, but that's a bigger discussion.
I need to do find and replace in a Google doc. Essentially, I have a template Google Doc that I want to copy and customize, programatically.
The original and the copy should both be in the native Gdoc format, and it should look the same before and after, in terms of visual layout and formatting.
Tried downloading HTML (and other formats) via the exportLink, doing my find-and-replace on the output, then updating the content to be the output of the find-and-replace. But that screws up the formatting, and seems very... roundabout.
I'm using the Ruby client, for what that's worth, but the main question is, what's the best practice for doing a find-and-replace in a native Doc?
I think the easiest solution would be to use the replaceText method of the Document service in Apps Script:
https://developers.google.com/apps-script/class_document#replaceText