Project website: https://know.tirth.dev/MySQL-to-GoogleSheets-Python/
Executes a query on MySQL database, gets the data, creates a tab in a Google Sheet and dumps the data there
To run this package, you'll need:
-
Python 2.6 or greater
-
The pip package management tool
-
MySQL connector for python
You can install it by executing below commandpip install mysql-connector-python
-
A Google account which has edit access to the sheet you are trying to modify
-
Google Client Library
You can install it by executing below commandpip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
-
Client secret JSON file
You will need this file to access your Google Sheet
In order to get one, Follow below mentioned steps- Go to the API Console.
- From the projects list, select a project or create a new one.
- If the APIs & services page isn't already open, open the console left side menu and select APIs & services.
- On the left, click Credentials.
- Click New Credentials, then select OAuth client ID.
- Select Web application as application type for your project
- If this is your first time creating a client ID, you can also configure your consent screen by clicking Consent Screen. You won't be prompted to configure the consent screen after you do it the first time.
- Click Create client ID
- Download the newly created oAuth2.0 client id as JSON
- Put the json file in src folder with name credentials.json
Refer this for more help.
- Follow instructions in automate.py
- After you have made all the required changes
- Open terminal in the project directory and execute below command
python automate.py