- Node.js installed
- A Google Cloud project
npm install -g @googleworkspace/cliVerify:
gws --version- Go to Google Cloud Console
- Select or create a project
- Navigate to APIs & Services → OAuth consent screen
- Set up the consent screen:
- User type: External
- Fill in the required fields (app name, support email)
- Add your Google account as a test user
- Save
- Navigate to APIs & Services → Credentials
- Click + Create Credentials → OAuth client ID
- Application type: Desktop app
- Click Create and Download JSON
- Go to APIs & Services → Library
- Search for Google Drive API
- Click Enable
Copy the downloaded client secret JSON to the gws config directory:
mkdir -p ~/.config/gws
cp ~/Downloads/client_secret_*.json ~/.config/gws/client_secret.jsongws auth loginThis opens a browser window. Sign in with the Google account you added as a test user.
# List first 10 files
gws drive files list --params '{"pageSize": 10}'
# List all files
gws drive files list --params '{"pageSize": 50}' --page-all# Search for files by name
gws drive files list --params '{"q": "name contains '\''budget'\''", "pageSize": 10}'
# List only spreadsheets
gws drive files list --params '{"q": "mimeType = '\''application/vnd.google-apps.spreadsheet'\''", "pageSize": 10}'
# List files in a specific folder
gws drive files list --params '{"q": "'\''FOLDER_ID'\'' in parents", "pageSize": 10}'