※本資料は、 Japan Microsoft 365 Developer Community Day 2021 イベントの「Office スクリプト (Office Scripts) & Power Automate」ハンズオンセッションの資料です。
※ハッシュタグ:#jpm365dcd , #OfficeScripts
- ハンズオンの目的
- ハンズオンの対象者
- タイムテーブル
- 事前準備
- ハンズオン環境
- ハンズオン内容
- もっとハンズオン!
- 参考Webサイト
- 参考動画
- Q&Aサイト・フィードバック先
- Office アドインのMicrosoft Learnコンテンツ
Ignite 2019で、Web版のExcel(Excel on the web)での処理をスクリプトで自動化する機能「Office スクリプト (Office Scripts)」が発表され、2021年5月に一般公開されました。 コードはTypeScript(JavaScript)で書くことができ、VBAの『マクロの記録』機能のように操作を記録・再生することもできます。
本ハンズオンは、「Office スクリプト」の概要と開発方法の学習を目的としています。
実際にスクリプトを書いて実行し、Power Automateとの連携を体験することで、 “Office スクリプトでどんなことができるのか” を学んでいきましょう!
本ハンズオンの対象者は下記の通りです。
- Web版のExcel(Excel on the web)を使ったことがあり、処理の自動化に興味がある。
- JavaScript(TypeScript)でコードを書いたことがある。
- Power Automateを知っている、あるいは使ったことがある。
- VBAマクロを書いたことがある。
- セッションレベル:Level 100- Beginner/Introductory 初学者向け ~ Level 200- Intermediate 初級者向け
ご挨拶~ハンズオン説明 | 5分 |
Microsoft 365 開発者プログラム説明 | 5分 |
Office スクリプト概要 | 20~30分 |
ハンズオン(「Excel on the web で Office スクリプトを記録、編集、作成する」、「Excel on the web で Office スクリプトを使用してブックのデータを読み取る」、「ブックに画像を追加する」) | 20分 |
休憩 | 5分 |
ハンズオン(「手動 Power Automation フローからスクリプトを呼び出す」、「フローからスクリプトにデータを渡す方法とスクリプトからデータを返す方法」、「Office スクリプトとPower Automateで見積書を発行する」、「フローからテーブルをフィルタリングして結果を取得する方法」、「フローからスクリプト経由でワークシート関数を実行する方法」) | 40分 |
もっとハンズオン!~Q&A | n分 |
まとめ&アンケートのお願い | 5分 |
- Microsoft 365 開発者プログラムの登録
Office スクリプトを利用するには、下記のサブスクリプションが必要となります。
当サブスクリプションをお持ちでない方は、「Microsoft 365 開発者プログラムの登録方法」を参考に、「Microsoft 365 開発者プログラム」に登録してください。本プログラムに登録することで、開発者用のMicrosoft 365 E5サブスクリプション(25ユーザーライセンス)を無料で取得できます。
- Microsoft 365 Business Standard
- Microsoft 365 Apps for business
- Microsoft 365 Apps for enterprise
- Office 365 E3
- Office 365 E5
- Office 365 A3
- Office 365 A5
- Office スクリプトの有効化
「スクリプトの可用性Officeスクリプトの共有を管理する」を参考に、Microsoft 365 管理センターからOffice スクリプトを有効にしてください。なお、本設定の反映には最大48時間かかる場合があります。
Office スクリプトが利用できる状態であれば、Web版のExcelを開いた際、「自動化」タブが表示されます。
(※タブが表示されないときは?)
OS | Windows 10 Pro x64 |
Office | Web版のMicrosoft Excel (Excel on the web) |
Browser | Microsoft Edge(Chromium版), Google Chrome |
- Office スクリプト概要
- Excel on the web で Office スクリプトを記録、編集、作成する (公式チュートリアル)
- Excel on the web で Office スクリプトを使用してブックのデータを読み取る (公式チュートリアル)
- ブックに画像を追加する (公式チュートリアル)
- 手動 Power Automation フローからスクリプトを呼び出す (公式チュートリアル)
- フローからスクリプトにデータを渡す方法とスクリプトからデータを返す方法
- Office スクリプトとPower Automateで見積書を発行する
- フローからテーブルをフィルタリングして結果を取得する方法
- フローからスクリプト経由でワークシート関数を実行する方法
余裕がある方は、是非下記内容にもチャレンジしてみてください! 😄
- サンプルスクリプト
- Power Automate フローでマクロ ファイルを使用する
- Office ScriptsとPower Automateで備品購入申請書を作成する
- スクリプトの戻り値を利用するフローのサンプル
- [Office Scripts]任意の場所にあるスクリプトを実行する方法
- Office ScriptsとPower Automateで簡単なメールアーカイブを作る方法
- Cross Reference and formatting two Excel files using Office Scripts
- Excel and Microsoft Forms integration using Office Scripts
- Office Scripts(Office スクリプト)の記事まとめ | 初心者備忘録
- Office ScriptによるExcel on the web開発入門 | 著者:掌田 津耶乃, 出版:ラトルズ
- Office スクリプト API リファレンス | Microsoft Docs
- Excel on the web での Office スクリプトのスクリプトの基本事項 | Microsoft Docs
- 組み込み JavaScript オブジェクト | Microsoft Docs
- Officeスクリプト コード エディター環境 | Microsoft Docs
- Office スクリプトと VBA マクロの違い | Microsoft Docs
- Office スクリプトと Office アドインの違い | Microsoft Docs
- Office スクリプトでの外部 API 呼び出しのサポート | Microsoft Docs
- Power Automate でスクリプトを実行する | Microsoft Docs
- トラブルシューティングの基本 | Microsoft Docs
- スクリプトパフォーマンスの機能強化 | Microsoft Docs
- プラットフォームの制限 | Microsoft Docs
- Office スクリプトの効果を元に戻す | Microsoft Docs
- Officeスクリプトのサンプルとシナリオ | Microsoft Docs
- Office スクリプトでのベスト プラクティス | Microsoft Docs
- Automate spreadsheets with Office Scripts in Microsoft Excel | Events
- Microsoft 365 Developer (Office Scripts) | YouTube
- Microsoft 365 Community (Office Scripts) | YouTube
- Sudhi Ramamurthy | YouTube
- Office Scripts with Power Automate | YouTube
- What's new in Office Scripts for Excel on the web | YouTube
- What’s cooking with Office Scripts: Getting Started | YouTube
- Excel Office Scripts: Send Teams meeting invite based on Excel table data | YouTube
- Excel Office Scripts: Calculate, create Chart, get Chart & Table image, Email | YouTube
- Excel Office Scripts: Manage calculate mode, calculate | YouTube
- Excel Office Scripts: Use Filter on Table and get Visible Range as Objects | YouTube
- Excel Office Scripts: Clear Hyperlinks from Excel Cells | YouTube
- Excel Office Scripts: Add comments to Excel Cells | YouTube
- Excel Office Scripts: Combine Excel tables into a master table | YouTube
- Excel Office Scripts: Move Rows Across Tables and Manage Filters | YouTube
- Excel Office Scripts: Range basics | YouTube
- Excel Office Scripts: Range read and write in perf optimized way (small data) | YouTube
- Excel Office Scripts: Application basics and environment | YouTube
- Office Scripts: Update large Excel range in performant way | YouTube
- API Call from Office Scripts | YouTube
- Office Scripts: Add Row at End of Worksheet | YouTube
- Office Scripts: Introduction to the make-up of a script | YouTube
- Office Scripts: Run Scripts for all Excel files in a folder using Power Automate | YouTube
- Office Scripts: Top 5 tips to improve your scripting skills in Excel | YouTube
- Stack Overflow - office-scripts
- Microsoft Q&A - office-scripts-excel-dev
- Microsoft User Research - Office Scripts Makers
- Microsoft Feedback Portal - Excel
Office スクリプトの兄弟的機能「Office アドイン」は、Microsoft Learnで学習コンテンツが用意されています。
興味がある方は是非こちらもチャレンジしてみてください。