Friday, August 7, 2020

Accessing Google Docs with KDE in Kubuntu Linux

Some years ago, I started using Google Docs as an easy way to access documents between different Linux computers and/or Android tablets. At some point, however, it became too annoying to access these documents only through the web browser on the Linux computers, and I basically stopped using Google Docs. But now, as I was setting up a new laptop computer with the most recent long-term support version of Kubuntu (20.04 LS), I thought it was worth investigating if there was a better solution. And I found one that lets me share images (jpg, png ,..), pdf files, and access text documents (with a few restrictions, see below) from both the Android tablet and the Linux PC.

Installation and Setup

The required software is "KIO GDRIVE" https://community.kde.org/KIO_GDrive.
It can be installed either from a package manager (I'm using Muon)...

... or directly from the command line

     sudo apt install kio-gdrive


Once this is installed, the next steps are rather straightforward. Open the Dolphin file browser, and click on "Network", ...
... select "Google Drive", ...
... and "Add new Account".
Select the type of account: "Google" ...
Important: In the following steps, it happened quite a few times that I got empty windows and, initially, I was about to give up. But accidentally, I figured out that resizing the window and/or reloading (right click -> reload) helped. Keep this in mind!! 

Then, the "Sign in" window opens and you insert the email address from your Google account. 
After hitting "Enter", the next window is asking for the corresponding password.
The next window displays the newly added account.
Selecting the account and pressing "OK", brings the next window which asks you to select the account. 
From there you get to window that asks you to confirm that you will get access to all files on the Google Drive.
Scroll down, and confirm.
Everything is set up now - press "Done".
The "Accounts" window is showing your email address and, below, the name for this account. In my case, it was called "google9" (for some reason, I deleted that account and when I repeated the procedure, it was called "google10" ). When you select it, and click "OK"... 
... you see the available services (here: Google Drive and YouTube) which can be de-selected. 
After pressing "OK" you are done - everything is set up!
Now, if you open Dolpin, and click in the left column on "Network", you see the new network folder "google9". When you click on this, you see all the files in your Google Drive.

To make the access a (little) easier, you can right-click on the new folder, and select "Add [...] to Places".
Now the Google Drive folder shows up directly on the left side in Dolphin, and it takes just a single click to access it.
  

What works - and what doesn't?

It took me a little while to figure this out. 

Yes: .jpg/.png Images and .pdf Files

When clicking on any image (.jpg or .png) in Dolphin, the image opens in Gwenview - great!
When clicking on any .pdf file in Dolphin, the file opens in Okular - great! 
In the Android Google Docs app, these formats work too

Not: Google Doc Text Documents and Spreadsheets .odf/.ods 

My first hope was that I would also be able to click on any text document that I created in Google Docs and be able to edit it. Nope! Does not work. A text file that I created inside Google Docs "test.odf" does not open. When I click on it in Dolphin, I just get a weird error message. The same happens for spreadsheets.

Simple .txt Text Files - somehow yes, but ...

Then I checked if this works for simple text documents. In Dolphin, right-click: "create new ... text file" - click opens the empty file in Kate - I typed a few words and saved it: test.txt. And, yes, the file is saved in the Google Drive. And if you have a second Linux computer, you will be able to access the file and save it again. But I want to access these files on my Android tablet. And if I enter the Google Doc app on Android, it will not directly open the .txt file. Instead, it opens another application (Polaris office in my case) where I can edit the document. But from there, I can not directly save it to the Google Drive. I can only save it to the Android file system, and from there share to Google Drive. While this works in principle, this is too complex for my everyday workflow.
And it's even worse, if you click on the document from the Google Doc web-interface. First, it will only display the content in view-only mode. Once you select "edit", you are able to edit the text. But you can not save it back to a simple .txt file - if you save it, it gets saved in .odf format as as test.txt.odf - and, as discussed above, you will not be able to access the updated file from Dolphin.

Best way to share Text Files: The .docx Format

The best option that I found for using Android and Kubuntu to work on a common document is the .docx format. You can not create such a document on the Google Drive. Instead, you create the initial document either on Linux (from Libreoffice) or an Android (using an office package like Polaris Office, or any other) and save it in the .docx format. From Android, it can then be shared to Google Drive, or from Linux it is simply moved in Dolphin to the Google Drive folder.
In Linux: From Dolphin you click on the document to open it (in Libreoffice), and when you save it, it is save and uploaded to Google Drive.
On Android: In the Google Doc app, you can access and edit the document, and any changes are saved in Google Drive.
Please note, however, that this does not allow you to work simultaneously on the document. Before working on Linux, it has to be saved on Android - and vice versa. But for my personal workflow, I do not require this feature.
And there is one more thing: Be careful when editing offline on Android! If you do offline editing on Android, when the file is ultimately saved to the Google Drive, all intermediate edits that you made on Linux will be ignored. So, if you really need offline editing, make sure that everything is saved before accessing the file from Linux.

No comments: