Create a Public Google Doc via Google Drive API in Scala

Table of contents
Reading Time: < 1 minute

In our earlier blog, we told about  “How to Create, Upload & Delete a Google Doc using Scala“. But the Google Docs that were created, had private access (by default), i.e., only the creator of Google Doc can access it. So, now we continue to add one more feature to it i.e., to Create a Public Google Doc via Google Drive API in Scala. With this feature we can make our Google Docs public so, that anyone can read them but not modify them.

To add this feature, follow these steps:

1. Import following package to create a variable of type Permission().

 

2. Get the access token to access your drive

 

3. Set the mimeType (type of Google Doc) of your Google Doc

MimeType can be Document/Spreadsheet/Presentation.

 

4. At last create the public Google Doc using following code

For more information on different access levels of Google Docs, click here.

Written by 

Himanshu Gupta is a software architect having more than 9 years of experience. He is always keen to learn new technologies. He not only likes programming languages but Data Analytics too. He has sound knowledge of "Machine Learning" and "Pattern Recognition". He believes that best result comes when everyone works as a team. He likes listening to Coding ,music, watch movies, and read science fiction books in his free time.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading