GoogleDrive

Updated goodls to v205

  • v2.0.5 (March 10, 2023)

    1. From this version, when the API key is used, the large file is downloaded by the API key. Because the specification for downloading the shared large file is sometimes changed. When the API key is not used, the shared large file is downloaded by the current specification (v2.0.4). If the shared large file cannot be downloaded by the change of the specification on Google’s side, please use the API key and test it again. The usage of goodls has not changed.

The detail information and how to get this are https://github.com/tanaikech/goodls.

Updated goodls to v204

  • v2.0.4 (March 9, 2023)

    1. From January 2024, it seems that the specification of the process for downloading a large shared file on Google Drive has been changed. So I updated goodls to reflect this. The usage of goodls has not changed. In the current stage, when a large share file is downloaded, it is required to click the following button.
    <form
      id="download-form"
      action="https://drive.usercontent.google.com/download"
      method="get"
    >
      <input
        type="submit"
        id="uc-download-link"
        class="goog-inline-block jfk-button jfk-button-action"
        value="このままダウンロード"
      />
      <input type="hidden" name="id" value="fileId" />
      <input type="hidden" name="export" value="download" />
      <input type="hidden" name="authuser" value="0" />
      <input type="hidden" name="confirm" value="t" />
      <input type="hidden" name="uuid" value="uuId" />
      <input type="hidden" name="at" value="some value" />
    </form>
    

    In this version, the URL obtained by this click is created, and the created URL is used for downloading it.

Resumable Download of File from Google Drive using Drive API with Python

Gists

This is a sample script for achieving the resumable download of a file from Google Drive using Dive API with Python.

There might be a case in that you want to achieve the resumable download of a file from Google Drive using Dive API with Python. For example, when a large file is downloaded, the downloading might be stopped in the middle of downloading. At that time, you might want to resume the download. In this post, I would like to introduce the sample script of python.

Retrieving Total File Sizes in Specific Folder of Google Drive using Google Apps Script

Gists

This is a sample script for retrieving the total file sizes in the specific folder of Google Drive using Google Apps Script.

There is a case where you want to retrieve the total file sizes in the specific folder of Google Drive using Google Apps Script. In this post, I would like to introduce a sample script for achieving this.

Sample script

Before you use this script, please enable Drive API at Advanced Google services. And please install FilesApp of a Google Apps Script library.

Updated goodls to v126

  • v1.2.6 (February 23, 2020)

    1. When the files are downloaded from the shared folder, if an error occurs, the download was stopped. In this thread, a request for skipping this error was proposed. This request was implemented at v1.2.6. Please try the option of --skiperror like below.
      • $ goodls -u https://drive.google.com/drive/folders/###?usp=sharing --skiperror

The detail information and how to get this are https://github.com/tanaikech/goodls.

Updated goodls to v125

  • v1.2.5 (January 29, 2020)

    1. An option for selecting whether the top directory is created was added.
      • $ goodls -u [URL] --notcreatetopdirectory or $ goodls -u [URL] -ntd
      • When this option is NOT used (default situation), when a folder including sub-folders is downloaded, the top folder which is downloaded is created as the top directory under the working directory. When this option is used, the top directory is not created and all files and sub-folders under the top folder are downloaded under the working directory.
      • This feature request was implemented.

The detail information and how to get this are https://github.com/tanaikech/goodls.

Moving File to Specific Folder using Google Apps Script

Gists

These are 3 sample scripts for moving a file to the specific folder in Google Drive using Google Apps Script.

Sample script 1

In this script, only Drive Service is used.

var sourceFileId = "###";
var destinationFolderId = "###";

var file = DriveApp.getFileById(sourceFileId);
DriveApp.getFolderById(destinationFolderId).addFile(file);
file
  .getParents()
  .next()
  .removeFile(file);

Sample script 2

In this script, only Drive API at Advanced Google services. (In this case, it’s Drive API v2.)

var sourceFileId = "###";
var destinationFolderId = "###";

Drive.Files.update({ parents: [{ id: destinationFolderId }] }, sourceFileId);

Sample script 3

In this script, only Drive API v3 is used.

Updated goodls to v110

goodls was updated to v.1.1.0

  • v1.1.0 (November 4, 2018)

    1. By using API key, files from the shared folder got to be able to be downloaded while keeping the folder structure.
      • This demonstration can be seen at Demo.
    2. By using API key, the information of shared file and folder can be also retrieved.
    3. About the option of --extension and -e, when -e ms is used, Google Docs (Document, Spreadsheet, Slides) are converted to Microsoft Docs (Word, Excel, Powerpoint), respectively.

The detail information and how to get this are https://github.com/tanaikech/goodls.

CLI Tool - goodls

Overview

This is a CLI tool to download shared files from Google Drive.

Description

We have already known that the shared files on Google Drive can be downloaded without the authorization. But when the size of file becomes large (about 40MB), it requires a little ingenuity to download the file. It requires to access 2 times to Google Drive. At 1st access, it retrieves a cookie and a code for downloading. At 2nd access, the file is downloaded using the cookie and code. I created this process as a CLI tool. This tool has the following features.