Google Apps Script: Creating Archives of Documents and Files of User in Google Apps Domain

Table of contents
Reading Time: 2 minutes

The Google Documents List API allows developers to create, retrieve, update, and delete Google Docs (including text documents, spreadsheets, presentations, and drawings), files, and collections. It also provides some advanced features like resource archives, Optical Character Recognition, translation, and revision history.

Documents List API is useful if we need to store data in the cloud, perform resource management, convert document formats, etc. All interactions with the API require a valid Google Account, which can be a “consumer” account (e.g. Gmail), or a Google Apps account.

Here, we are going to create archives of documents and files of user.
To initiate an archive request, send an authenticated POST request to the archive feed’s URI:

The archive feed can be used to export resources as a .zip file. User determines the desired export format for each type of resource and downloads the archive once the process has finished.

The following example archives all documents, spreadsheet, presentation, drawing, images, csv files and pdf, and a collection’s contents, and emails the link to ”<userId>” when the archive operation has finished.

Here, user can archives all documents and files in .zip format. A admin user can archive all domain user’s documents and files by giving user’s email id, once the process has finished, the User can downloads the archive from his account.