Skip to content

wescpy/google

@wescpy Google blog code samples

Introduction

This repo contains developer code samples from the Coding #Python and #Google with @wescpy blog as well as older but still relevant content such as posts from the old G Suite blog as well as @wescpy's former Google/Python blog. Where possible and time-permitting, equivalent Node.js samples will be available as well.

Content structure

Samples demonstrating only one product group are prefixed under the product group name (see table below) while cross-product samples will go into multi.

DirectoryAPI families
appsGoogle Workspace ("GWS"; formerly G Suite and Google Apps)
cloudGoogle Cloud (Platform; "GCP")
geminiGemini API
mapsGoogle Maps (Platform; "GMP")
youtubeYouTube
multi(multi-product sample apps) [N/A at this time]
videos(not really code) select related videos; all product families
Code sample categories/folders

Code samples

The chart below identifies the code samples and posts covering them:

CodeSampleBlog post
apps/export-doc-pdf/Export Google Docs as PDF (Node.js & Python)Export Google Docs as PDF
apps/gmail/Query for chatty Gmail threads (Node.js & Python)Gmail API developer intro
apps/import-csv/Import CSV to Google Sheets (Node.js & Python)Import CSV to Google Sheets
apps/md2docs/Basic Markdown-to-Google Docs converter (Node.js & Python)Basic Markdown-to-Google Docs converter
apps/sheets_display.pyDisplay contents of public SheetAPI keys 2
apps/drive_list.py (other repo)Display first 100 files/folders in Google Drive (Python old auth)OAuth client ID 3
apps/drive_list-new.py (other repo)Display first 100 files/folders in Google Drive (Python new auth)OAuth client ID 3
apps/drive_list.js (other repo)Display first 100 files/folders in Google Drive (Node.js CommonJS [require])OAuth client ID 3
apps/drive_list.mjs (other repo)Display first 100 files/folders in Google Drive (Node.js ES Module [import])OAuth client ID 3
cloud/language/nlp_sent_query.pySentiment analysis of text using Natural Language API w/lower-level platform Google APIs client libraryAPI keys 2
cloud/language/nlp_sent_query-gcp.pySentiment analysis of text using Natural Language API w/higher-level product GCP client libraryAPI keys 2
cloud/appengine/App Engine "Hello World!" apps (Node.js & Python)Using App Engine in 2024
cloud/cloudrun/Cloud Run "Hello World!" apps (Node.js & Python)Modern app-hosting without servers
cloud/transnatlang/Text-based language processing (Node.js & Python)Text-based language processing
gemini/*Google AI Gemini API samples (Node.js & Python)Gemini API "Hello World!", Gemini 102: Beyond "Hello World!", Gemini 2.0 Audio
gemini/webgem/Google AI Gemini API web apps (Node.js & Python)Gemini 102a: Creating basic gen AI web apps
gemini/images/Google AI Gemini API image generation samples (Node.js & Python)Generating images with Gemini 2.0 Flash from Google
gemini/gem25/Gemini 2.5 API samples (Node.js & Python)Gemini 2.5 API Missing Manual
maps/Maps Geocoding, Directions, and Time Zone APIs (Node.js & Python)Explore the world with Maps APIs
maps/maps_geocode.pyGeolocate address with Maps Geocoding APIAPI keys 2 and Explore the world with Maps APIs
youtube/Query for (public) YouTube videos (Node.js & Python)Intro to the YouTube APIs
youtube/yt_video_query.pyQuery for (public) YouTube videos (Python)API keys 2 (and Intro to the YouTube APIs)
Code sample table of contents

Support

"Support" will be provided in a "best-effort" manner. Open to fixes and updates to existing samples and affected blog posts. File a "bug" against an existing sample with details. If there is a "missing" sample you are proposing that doesn't exist (whether you write the code and submit the PR or are requesting someone do it), also file a bug and state why it would benefit the community. Currently, only (server-side) Python and JavaScript (Node.js, Apps Script) samples are being considered.