Google-apps-script – Process all files in Google Drives into Google Docs

google docsgoogle-apps-scriptgoogle-drive

I realised that I can convert all my images (and pdf files and such) in Google Drive to Google Docs and I won't be eating up any of my usage. Unfortunately, I have a crazy amount of images.

How can I write a Google Apps script to convert all my images to Google Docs?

Best Answer

Right click/Open With /Google Docs does convert pdf (and it is new to my knowledge jpg) files into Google Documents. ;)

Caution:
- If I was you I will keep a copy of my original files somewhere else before deleting them from Google Drive.
- I would also check the results of different kind of pdf files to be converted into google docs (pdf with images only, pdf OCRed, pdf protected by passwords,..small file, big file...etc....).
- Also the way Google convert to Google Docs can change and they won't tell you so !! This was the case during the last 6 months of 2016 were it was not possible to include image + ocr when converting a pdf file to Google Docs (you would have only the OCRed text as a result).

Automating the conversion process : here are 2 ideas :
1) Uploading again all your files from your computer into Google Drive using a program called Syncdocs. Plus adjust its internal settings : "Pdf file will not convert to Google Docs, unless the setting "ForcePDFToDoc" is set to true in the appsettings.xml file. " http://www.syncdocs.com/forums/topic/pdf-conversion-issues#post-10464
Also search in their forum for : "Daily limit to conversion ?")
You also have the 1 Million characters limit when a file is converted to Google Doc : "Documents: Up to 1.02 million characters. If you convert a text document to Google Docs format, it can be up to 50 MB." see Google Drive help.

2) You can use a Google Apps script. Sorry I don't have one on hand. You should ask at stackoverflow IMHO. I just assume that you will hit the 5 minute execution (or so now) limit for your script pretty easily. You may also hit the daily limit (Google "Quotas for Google Services"). So maybe a script like this one could help : http://patt0.blogspot.com/2014/08/continuous-batch-library-update-for.html

Note: in case you don't know you can also use Google Photos to store your photo for free (you will need to upload the photos again using "Google Photo Backup" and adjust you setting to high quality). You can also have them into Google Drive (see settings).
Note2: sorry for some reasons, I can't add more than 2 urls in this post!