Power Automate Desktop Excel グラフ

Power Automate Desktop Excel グラフ
Power Automate

2022.10.16 2022.02.25

Power AutomateにあるExcelのアクション「スクリプトの実行」がかなり便利そうだったので遊んでみた。

参考サイト

Excel Online限定のOffice スクリプトを使用してグラフを作成し、そのグラフを画像としてPower Automateでメール送信してみる。

Excelの準備

そのExcelをOneDriveとかSharePoint OnlineとかのExcel Onlineで使用できる場所にアップロードする。

Power Automate Desktop Excel グラフ

そしたらそのファイルをExcel Onlineで開いて、[自動化]タブの[新しいスクリプト]を選択し、コードエディターを開く。

Power Automate Desktop Excel グラフ

スクリプトを保存したらExcel側の準備は完了!

Power Automate Desktop Excel グラフ

Power Automate実装

そしたら適当なトリガーでPower Automateのフローを作成し、Excel Onlineの「スクリプトの実行」アクションを追加。

Power Automate Desktop Excel グラフ

さっき作ったExcelとスクリプトを指定してあげる。

Power Automate Desktop Excel グラフ

※スクリプトの戻り値はこんな感じ。

Power Automate Desktop Excel グラフ

実行

そしたらこのフローを実行してみると、

Power Automate Desktop Excel グラフ

メールが届いてこんな感じでTypeScriptで作成したグラフが画像として送られてくる!

Power Automate Desktop Excel グラフ

もちろんTypeScriptの方のコードを修正すると、

Power Automate Desktop Excel グラフ

こんな感じで作成/送信するグラフを変えることもできる!

Power Automate Desktop Excel グラフ

Power AutomateとExcelでできることってかなり限られているイメージだったけど、この「スクリプトの実行」アクションを活用することで色んなことができそうな予感!