PythonスクリプトからGoogleスプレッドシートへのアクセスができる「gsheets」をインストール

スポンサーリンク

PythonスクリプトからGoogleスプレッドシートへのアクセスができるライブラリ「gsheets」のインストールについて解説しています。

gsheetsは、Google Sheets API (v4)のラッパーで、Pythonスクリプトから Google Sheets(スプレッドシート)へのより便利なアクセスが行えるライブラリです。

■Python

今回のPythonのバージョンは、「3.8.5」を使用しています。(Windows10)(pythonランチャーでの確認)

■gsheetsをインストールする

gsheetsをインストールを行いますが、今回はpipを経由してインストールを行うので、まずWindowsのコマンドプロンプトを起動します。

pip install gsheets

起動後、上記のコマンドを入力し、Enterキーを押します。

なお、今回は、pythonランチャーを使用しており、Python Version 3.8.5にインストールを行うために、pipを使う場合にはコマンドでの切り替えを行います。

py -3.8 -m pip install gsheets

切り替えるために、上記のコマンドを入力し、Enterキーを押します。

Defaulting to user installation because normal site-packages is not writeable
Collecting gsheets
Downloading gsheets-0.6-py3-none-any.whl (19 kB)
Requirement already satisfied: google-api-python-client in c:\users\user_\appdata\roaming\python\python38\site-packages (from gsheets) (2.11.0)
Collecting oauth2client>=1.5.0
Downloading oauth2client-4.1.3-py2.py3-none-any.whl (98 kB)
|████████████████████████████████| 98 kB 857 kB/s
Requirement already satisfied: uritemplate<4dev,>=3.0.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-python-client->gsheets) (3.0.1)
Requirement already satisfied: google-auth-httplib2>=0.1.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-python-client->gsheets) (0.1.0)
Requirement already satisfied: google-api-core<2dev,>=1.21.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-python-client->gsheets) (1.30.0)
Requirement already satisfied: six<2dev,>=1.13.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-python-client->gsheets) (1.15.0)
Requirement already satisfied: httplib2<1dev,>=0.15.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-python-client->gsheets) (0.19.1)
Requirement already satisfied: google-auth<2dev,>=1.16.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-python-client->gsheets) (1.32.1)
Requirement already satisfied: rsa>=3.1.4 in c:\users\user_\appdata\roaming\python\python38\site-packages (from oauth2client>=1.5.0->gsheets) (4.7.2)
Requirement already satisfied: pyasn1-modules>=0.0.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from oauth2client>=1.5.0->gsheets) (0.2.8)
Requirement already satisfied: pyasn1>=0.1.7 in c:\users\user_\appdata\roaming\python\python38\site-packages (from oauth2client>=1.5.0->gsheets) (0.4.8)
Requirement already satisfied: requests<3.0.0dev,>=2.18.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client->gsheets) (2.25.1)
Requirement already satisfied: protobuf>=3.12.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client->gsheets) (3.17.3)
Requirement already satisfied: googleapis-common-protos<2.0dev,>=1.6.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client->gsheets) (1.53.0)
Requirement already satisfied: pytz in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client->gsheets) (2021.1)
Requirement already satisfied: setuptools>=40.3.0 in c:\program files\python38\lib\site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client->gsheets) (47.1.0)
Requirement already satisfied: packaging>=14.3 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-api-core<2dev,>=1.21.0->google-api-python-client->gsheets) (20.9)
Requirement already satisfied: pyparsing<3,>=2.4.2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from httplib2<1dev,>=0.15.0->google-api-python-client->gsheets) (2.4.7)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in c:\users\user_\appdata\roaming\python\python38\site-packages (from google-auth<2dev,>=1.16.0->google-api-python-client->gsheets) (4.2.2)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.21.0->google-api-python-client->gsheets) (1.26.5)
Requirement already satisfied: idna<3,>=2.5 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.21.0->google-api-python-client->gsheets) (2.10)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.21.0->google-api-python-client->gsheets) (4.0.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\user_\appdata\roaming\python\python38\site-packages (from requests<3.0.0dev,>=2.18.0->google-api-core<2dev,>=1.21.0->google-api-python-client->gsheets) (2021.5.30)
Installing collected packages: oauth2client, gsheets
Successfully installed gsheets-0.6 oauth2client-4.1.3

Enterキーを押すと、インストールが開始され、上記のように「Successfully installed」と表示されます。これが表示されれば、gsheetsが正常にインストールされたことになります。

なお、今回はgsheetsのバージョン0.6をインストールしました。

コメント

タイトルとURLをコピーしました