はじめにTIG真野です。 Google DriveにアップロードされたExcelファイルを利用したちょっとしたジョブを実装する機会があり、処理を動かしたいのがAWSなど別のプラットフォームであったため、サービスアカウントを用いてGoogle Drive APIにアクセスするGoプログラムを作りました。 いくつかの人が書いている通り、Google Drive APIもv2, v3で情報が入り乱れていて本家のドキュメントを探したて見ながら試行錯誤したりちょっと悩みました。また、サービスアカウント利用する実装例が少なかったので手順をまとめていきます。 認証方式Google Drive APIを用いたコード実装を始める前に、事前にアカウントなどの権限周りの準備を実施します。 Google Drive APIを使うための認証方式には大きく4つの方法があります。 APIキー: 一般公開データに匿名でア