DriveList (FSearch) is a powerful Python command-line tool for searching and exporting file metadata from Google Drive. It supports two operational modes: Local Mode (scanning Google Drive Desktop synced folders directly from the filesystem) and OAuth Mode (querying the Google Drive API remotely). Results can be exported to CSV, JSON, or TXT files and appended directly to Google Sheets.
- Dual Search Modes: Local filesystem scanning (fast, no API quota) and Google Drive API via OAuth.
- Multi-Target Processing: Process Clients, Consultants, or both directories in a single run.
- Flexible Output: Export to CSV, JSON, TXT, and Google Sheets simultaneously.
- Duplicate Control: Optional duplicate detection before appending records to Google Sheets.
- Stats Mode: Append a summary statistics row to dedicated stats sheets (
LSheet_STATS/ASheet_STATS) per run. - Credential Management: Service account for Sheets upload; OAuth desktop credentials for Drive API mode.
| Layer | Technology |
|---|---|
| Language | Python 3.10+ |
| Google Sheets | gspread, google-auth |
| Google Drive API | google-api-python-client, google-auth-oauthlib, google-auth-httplib2 |
DriveList/
├── DriveSearch.py # Main application: search, export, Google Sheets upload
├── DriveSearch.py.backup # Backup of a previous version
├── backup.bat # Windows batch file for quick backup
├── credentials.json # OAuth client credentials (gitignored)
├── service-account.json # Service account key for Sheets (gitignored)
├── token.pickle # OAuth session token (gitignored)
└── README.md # Documentation
graph TD
User([User CLI]) -->|Selects Target & Mode| App[DriveSearch.py]
App -->|Local Mode| LocalFS[Filesystem os.walk]
App -->|OAuth Mode| DriveAPI[Google Drive API]
LocalFS --> Results[File Metadata List]
DriveAPI --> Results
Results -->|Optional Dedup Check| GSheets[(Google Sheets)]
Results --> CSV[CSV / JSON / TXT Export]
Results --> StatsRow[Stats Summary Row Append]
# Install dependencies
pip install gspread google-auth google-api-python-client google-auth-oauthlib google-auth-httplib2
# Place service-account.json and/or credentials.json in the project folder
# Run interactively
python DriveSearch.py
# Run with statistics
python DriveSearch.py --stats- Google Sheets Upload: Use a Service Account JSON (
service-account.json). Share target Google Sheet with the service account email. - OAuth / Drive API Mode: Create OAuth Desktop credentials (
credentials.json). First run opens a browser for authorization and savestoken.pickle.
credentials.json,service-account.json, andtoken.pickleare all in.gitignore. Never commit them.
MIT License
By OutLawZ™
Website: https://www.brandex.pk
Contact:
📧 Email: net2tara@gmail.com 🌐 Website: https://www.brandex.pk
Made with ❤️ by OutLawZ™