googledriveパッケージについて

以下の3つの関数でこと足りる気がするのでまとめておく

drive_find について

  • ディレクトリやファイルの検索関数
  • 検索対象の 名前ID を取得可能
  • 検索範囲を拡張子やタイプで type で指定可能
    • document : Google Docs
    • presentation : Google Slides
    • spreadsheet : Google Sheets
    • folder : フォルダ
    • csv xlsx pdf etc : 拡張子
  • 表示件数を n_max で指定可能(デフォルトは全件検索)
drive_find(pattern = '{オブジェクト名}', n_max = 50)
drive_find(type = 'folder', n_max = 50)

drive_ls について

  • ディレクトリ構造の表示関数
  • 表示対象はディレクトリの名前やIDを path に入力して指定
  • 表示範囲を recursive で指定可能
    • recursive = F : ディレクトリ直下の全ファイルを表示(デフォルト設定)
    • recursive = T : ディレクトリ内の全ファイルを表示
drive_ls(path = '{ディレクトリ名}')
drive_ls(path = as_id('{ID}'))

drive_ls(path = '{ディレクトリ名}', recursive = T)
drive_ls(path = as_id('{ID}'), recursive = T)

drive_ls(path = '{ディレクトリ名/子ディレクトリ名}')

drive_download について

  • ファイルのダウンロード関数
  • ダウンロード対象はファイルの名前やIDを file に入力して指定
  • ファイルの形式と保存先は path で指定可能
drive_download(file = '{ファイル名}')
drive_download(file = as_id('{ID}'))

drive_download(file = '{ファイル名}', path = '{DLしたファイルの保存先/hogehoge.csv}')