LoginSignup
0
0

More than 1 year has passed since last update.

PowerAutomate: *.xls → *.xlsx 変換(3rd Party Connector)

Last updated at Posted at 2022-07-16

背景

以下の記事で必要となった、*.xls → *.xlsx の変換コネクターの動作確認
3rd Party 製なので会社の DLP 上は使えないんですが・・

外部のオープンデータなら、自宅環境で変換かけて、変化検知時に送り込めば自動化は出来るな、と思い直しての動作確認

ちなみに、PAD の場合は以下

概要

世の中そんなうまい方法ない・・ってのが結論。

  • plumsail コネクターを使って変換
    いい感じなんだけど、一定数無償、とかではないので、この用途には使いたくない、という結論に・・

  • Cloudmersive コネクターを使って変換
    動けば、Free Tier もあっていいんだけど・・同一フローで何故か 10回に 1回以下の正常動作。
    原因がわからないので使えず・・

制約と価格

image.png

plumsail コネクター

有償 30day Free Trial
image.png

Cloudmersive コネクター

無償で全然いける。ただ、会社用はアウト

image.png

試行例

plumsail

以下で plumsail にログイン:既存の Google/Microsoft アカウントで連携もOK

API キーの生成

  1. API Keys ページへ
  2. Add new で、新規追加
  3. コピーしておく

image.png

Connector にて接続情報をコピペ
image.png

あとは、Content を渡すだけなので、外部ファイルの場合は、以下のようにすれば完了
image.png

クリップボードコピペ用

外部オープンデータの xls → xlsx 変換
{"id":"5823509b-86f7-4db9-ab71-ca99576fb743","brandColor":"#8C3900","connectionReferences":{"shared_onedriveforbusiness":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness/connections/shared-onedriveforbu-60023b13-318a-4e0f-a004-302d9501e437"}},"shared_plumsail":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_plumsail/connections/shared-plumsail-99e4b27a-ce01-4129-9f2b-4d194c37e75f"}}},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"外部オープンデータの_xls_→_xlsx_変換","operationDefinition":{"type":"Scope","actions":{"Upload_file_from_URL":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_onedriveforbusiness","operationId":"CopyFile","apiId":"/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness"},"parameters":{"source":"https://media.japanmetaldaily.com/data/KS10001.xls","destination":"ForAutomate/ConvertXls2Xlsx/KS10001.xls","overwrite":true},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{}},"Get_file_content":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_onedriveforbusiness","operationId":"GetFileContent","apiId":"/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness"},"parameters":{"id":"@outputs('Upload_file_from_URL')?['body/FileLocator']","inferContentType":true},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{"Upload_file_from_URL":["Succeeded"]}},"Convert_XLS_to_XLSX":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_plumsail","operationId":"FlowV1DocumentsJobsXls2XlsxPost","apiId":"/providers/Microsoft.PowerApps/apis/shared_plumsail"},"parameters":{"request/documentContent":"@body('Get_file_content')"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{"Get_file_content":["Succeeded"]}},"Create_file":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_onedriveforbusiness","operationId":"CreateFile","apiId":"/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness"},"parameters":{"folderPath":"/ForAutomate/ConvertXls2Xlsx","name":"KS10001.xlsx","body":"@body('Convert_XLS_to_XLSX')"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{"Convert_XLS_to_XLSX":["Succeeded"]},"runtimeConfiguration":{"contentTransfer":{"transferMode":"Chunked"}}}},"runAfter":{}}}

参考

Cloudmersive コネクター

ほぼ同様なので省略

以下の例のように、成功・失敗でのフローの利用方法の差異が無く、Automate ではどうしようもないかなぁ・・と

成功例

image.png

失敗例

成功例で、そのまま Resubmit するだけでエラーになる。

The response is not in a JSON format.

image.png

1 Calls/Second

ここに引っかかってるのかと思ったが、秒単位だし、ファイルも小さいので全然問題なさそう・・

image.png

Cloudmersive を HTTP Post で直接

提供されてるコネクターに問題があるのかと思い、HTTP POST で直接実行してみる

成功例 by HTTP

初っ端成功して、やっぱりコネクターか?と思った・・が、
image.png

Resubmitするだけで、以下のようなエラーになる・・
image.png
image.png

ということで、諦め

あとがき

どちらにせよ、個人利用じゃないと後者のコネクターも使えないので、今回は諦めて手動更新・・かな・・

keyword

how to convert xls to xlsx by Power Automate instead of Power Automate Desktop

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0