Google Drive API のサンプル
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
このセクションでは、Google Drive API のサンプルを示します。
Drive API の概要動画については、 Drive API 動画ライブラリをご覧ください。
Google は、GitHub で次のサンプルをホストしています。これらのリポジトリをフォークして、独自のプロジェクトのリファレンスとしてコードを使用できます。
Google Picker
Google ピッカーのコードサンプルでは、ユーザーがウェブアプリのボタンから開くことができる画像選択ツールまたはアップロード ページを使用する方法を示します。
ソースを表示またはダウンロードするには、GitHub リポジトリの Google Picker にアクセスしてください。
Quickeditor でファイルを開いて保存する
この Quickeditors コードサンプルは、Drive API を使用してファイルを開いて保存する方法を示しています。
Drive プラットフォーム固有の各例は、単一のサンプルアプリ(Quickeditor というテキスト エディタ。MIME タイプ text/*
の Drive ファイルを編集可能)を反映しています。ウェブ版では、次の 2 つの基本的なドライブのユースケースが実装されています。
どちらのユースケースもフローは似ています。ユーザーが作成メニューまたは登録済みの MIME タイプのファイル コンテキスト メニューからアプリを選択すると、ドライブはユーザーをアプリにリダイレクトします。
ソースを表示またはダウンロードするには、GitHub リポジトリの Drive Quickeditors にアクセスしてください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-29 UTC。
[null,null,["最終更新日 2025-08-29 UTC。"],[],[],null,["# Google Drive API samples\n\nThis section provides samples for Google Drive API.\n\nFor introductory videos about Drive API, see the [Drive API\nvideo library](/workspace/drive/api/guides/videos).\n\nGoogle hosts the following samples on GitHub. You can fork these repositories\nand use the code as a reference for your own projects.\n\nGoogle Picker\n-------------\n\nThe [Google Picker code sample](/workspace/drive/picker/guides/sample) shows how to use\nan image selector or upload page that users can open from a button in a web app.\n\nTo view or download the source, visit\n[Google Picker](https://github.com/googleworkspace/browser-samples/tree/main/drive/picker)\non the GitHub repository.\n\nOpen and save files with Quickeditors\n-------------------------------------\n\nThis Quickeditors code sample shows how to open and save files with the\nDrive API.\n\nEach of the Drive platform-specific examples reflects a single\nsample app: a text editor, called a Quickeditor, capable of editing\nDrive files with the MIME type `text/*`. The [web\nversion](https://github.com/googleworkspace/drive-quickeditors/tree/main/web)\nimplements two fundamental Drive use cases:\n\n- [Integrate with Drive UI's \"New\" button](/workspace/drive/api/guides/integrate-create)\n- [Integrate with Drive UI's \"Open with\" context menu](/workspace/drive/api/guides/integrate-open)\n\nThe flow for both use cases is similar. Drive redirects a user to\nthe app after the user selects it from the create menu or the context menu of a\nfile with a registered [MIME type](/workspace/drive/api/guides/mime-types).\n\nTo view or download the source, visit [Drive\nQuickeditors](https://github.com/googledrive/web-quickeditor) on the GitHub\nrepository.\n\nRelated topics\n--------------\n\n- [The Google Picker API](/workspace/drive/picker/guides/overview)\n- [Drive UI integration overview](/workspace/drive/api/guides/about-apps)"]]