Automate order data extraction from food delivery services like DoorDash, Uber Eats, and Menulog. This Python toolkit scrapes order details from Gmail confirmation emails, simplifying data collection for analysis or tracking
Before starting, set up the following directory structure in the project root:
creds/
: For storing API credentials.data/
: For data files including results ofmain.py
.cache/
: Subdirectory for cached data files.
Note: The creds/
and data
directories are ignored in .gitignore
for security and privacy reasons.
To use the Gmail functionalities, you need to set up your Google API credentials. Follow the 'Set up your environment' section in this Python Quickstart guide, which contains a step-by-step walkthrough.
After completing the guide::
- Ensure the
creds/
directory exists at the root of the project. - Save your credentials as
creds/credentials.json
.
Note: The creds/
directory is ignored in .gitignore
for security reasons. Ensure your personal credentials are not pushed to the repository.
To utilize the Google Sheets functionalities in the project, configure Google Sheets API credentials:
- Navigate to the Google Developer Console.
- Create a new project or select an existing one.
- Enable the
Google Sheets API
and theGoogle Drive API
for your project. - Go to the "Credentials" page and click on "Create Credentials". Choose "Service account".
- Fill in the service account details (optional, grant it a role with appropriate permissions)
- Once the service account is created, click on it to manage keys.
- Add a new key of type JSON. The key file will be downloaded automatically.
- Rename this file to
sheets_serviceaccount.json
and place it in thecreds/
directory of your project.
Note: Like with the Gmail API, the creds/
directory is part of the .gitignore
file to prevent sensitive data from being pushed to the public repository. Ensure you do not upload your personal credentials.
- Go to Google Sheets.
- Create a blank spreadsheet and rename it "Doordash Orders".
- Click on "Share" and add your service account email as an Editor. This can be found as the value associated with
client_email
in thesheets_serviceaccount.json
file you created in the previous step.
You're all set up and ready to go!