Skip to content

A Python-based desktop application that allows you to upload folders and files to Google Drive while maintaining the folder structure and generating shareable links.

Notifications You must be signed in to change notification settings

themrsami/python-google-drive-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Google Drive Folder Uploader

A Python-based desktop application that allows you to upload folders and files to Google Drive while maintaining the folder structure and generating shareable links.

Features

  • Upload entire folder structures to Google Drive
  • Maintain original folder hierarchy
  • Generate shareable links for all uploaded files
  • Dark theme UI
  • Progress tracking for uploads
  • Concurrent file uploads using thread pools
  • Automatic JSON export of file links

Requirements

  • Python 3.7+
  • PySide6
  • Google Drive API credentials

Python Dependencies

pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib PySide6

Setup

  1. Create a Google Cloud Project:

    • Go to Google Cloud Console
    • Create a new project
    • Enable the Google Drive API
    • Configure OAuth consent screen
    • Create OAuth 2.0 credentials
    • Download the credentials and save as credentials.json in the project directory
  2. Place the files:

    • Ensure script.py and credentials.json are in the same directory
    • First run will generate token.json after authentication

Usage

  1. Run the application:

    python script.py
  2. Using the application:

    • Click "Select Folder to Upload" to choose a folder
    • The application will maintain the folder structure in Google Drive
    • Progress bar shows upload status
    • Uploaded files will be shared with "anyone with the link" access
    • Links are saved in uploaded_links.json after completion

Output

The application generates uploaded_links.json containing paths and shareable links:

{
    "folder1/file1.txt": "https://drive.google.com/file/d/...",
    "folder1/subfolder/file2.txt": "https://drive.google.com/file/d/..."
}

Directory Structure Example

Local folder structure before upload:

MyProject/
├── docs/
│   ├── requirements.txt
│   └── api/
│       └── spec.md
├── src/
│   ├── main.py
│   └── utils/
│       └── helper.py
└── README.md

Google Drive structure after upload:

MyProject/
├── docs/
│   ├── requirements.txt
│   └── api/
│       └── spec.md
├── src/
│   ├── main.py
│   └── utils/
│       └── helper.py
└── README.md

Generated uploaded_links.json:

{
    "docs/requirements.txt": "https://drive.google.com/file/d/1ABC...",
    "docs/api/spec.md": "https://drive.google.com/file/d/2DEF...",
    "src/main.py": "https://drive.google.com/file/d/3GHI...",
    "src/utils/helper.py": "https://drive.google.com/file/d/4JKL...",
    "README.md": "https://drive.google.com/file/d/5MNO..."
}

Notes

  • The application uses threading for concurrent uploads (4 workers)
  • Files are automatically set to be viewable by anyone with the link
  • Progress is shown both with a progress bar and status messages
  • The dark theme UI provides better visibility

About

A Python-based desktop application that allows you to upload folders and files to Google Drive while maintaining the folder structure and generating shareable links.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages