メインコンテンツへスキップ

ワークシートを抽出する Excel で Power Automate

PDF4me ワークシートを抽出する は Power Automate 1 つ、複数、またはすべてのワークシートを変換するアクション Excel ワークブックを構造化 JSON各シートの最初の行を列ヘッダーとして使用します。これを使用してワークシートデータを APIデータベースのインポート、または JSON 解析コードを一切書かずにアーカイブを作成する。

このアクションが何をするか

PDF4me ワークシートを抽出する 取る Excel ファイルとオプションのワークシート選択、そして JSON 抽出されたワークシート名ごとに1つのキーを持つオブジェクト。各キーには、そのシートのヘッダー行とデータ行から構築された行オブジェクトの配列が格納され、数値、日付、ブール値、テキストは元の形式で保持されます。 JSON 種類。

関連ブログ記事
この機能に関するブログ記事はまだありません。近日公開予定です。
その間、PDF4me ブログを閲覧して、あらゆるプラットフォームのチュートリアルやワークフローをご覧ください。
ブログをご覧ください →

認証 API リクエスト​

アクセスするには PDF4me ウェブ API を通して Power Automateすべてのリクエストには有効な API キー。認証はあなたの身元を検証し、コネクタがアクセスできるようにします。 PDF4meの Excel ワークフローからワークシートを抽出するサービス。

見逃してはならない重要な事実​

空白の選択とは、すべてのワークシートを意味します。
ワークシート名とワークシートインデックスの両方を空欄にしておくと、ワークブック内のすべてのワークシートを一度に抽出できます。
名前とインデックスの選択が結合してユニオンになります
両方のフィールドに入力されている場合、どちらか一方のリストに一致するワークシートはすべて一度ずつ抽出され、両方に一致するワークシートだけが抽出されるわけではありません。
ワークシートのインデックスは0から始まります
インデックス0は最初のワークシート、インデックス1は2番目のワークシート、といった具合です。ワークシート名の比較では、大文字と小文字が区別されます。
Power Automate PDF4me Excel の「ワークシートの抽出」アクションで、ファイルコンテンツ、ファイル名、ワークシート名、ワークシートインデックスの各フィールドが表示されます。

前の操作からファイルの内容とファイル名をマッピングし、ワークシート名やワークシートインデックスを設定するか、両方を空白のままにしてすべてのシートを抽出します。

パラメータ​

必須: ファイルの内容とファイル名は必ず指定してください。ワークシート名とワークシートインデックスはどちらも任意です。空欄のままにすると、すべてのワークシートが抽出されます。

パラメータ必須その機能例
File ContentRequiredContent of the Excel file to process. Map it from the file content returned by a previous action, such as SharePoint or OneDrive Get file content.@{body('Get_file_content')?['$content']}
File NameOptionalName of the Excel file, including its extension (for example `report.xlsx`). Map it from the file name returned by a previous action. Defaults to `ExtractWorksheets.xlsx`.report.xlsx
Worksheet NamesOptionalComma-separated list of worksheet names to extract ( e.g. Sheet1,Sheet3 ).your value
Worksheet IndexesOptionalComma-separated list of worksheet indexes (1-based) to extract ( 1,2,3).your value

「ワークシートの抽出」機能は何を返しますか?​

分野タイプ内容物
Excel file with extracted sheetsFile contentContent of an Excel file that contains only the extracted worksheets. Map it into the next action, for example the File Content field of SharePoint or OneDrive Create file.
SuccessYes/NoWhether the operation completed successfully
Error MessageTextError message if operation failed
Error DetailsArrayList of detailed error messages
{
"document": "<file content>",
"FileName": "report.txt",
"Success": true,
"ErrorMessage": null,
"Errors": []
}

デコードされた文書コンテンツの例:

{
"Employees": [
{"Name": "John Doe", "Age": 30, "Department": "IT"},
{"Name": "Jane Smith", "Age": 28, "Department": "HR"}
],
"Sales": [
{"Product": "Widget", "Units": 100, "Revenue": 2500.00},
{"Product": "Gadget", "Units": 75, "Revenue": 1875.00}
]
}

よくあるエラーメッセージ​

エラーメッセージ原因解決
Request is emptyRequest object is null.Provide a valid request object.
Document is emptyDocument object is null or DocData is null.Provide a valid Excel document.
Workbook contains no worksheetsExcel file has 0 worksheets.Provide a valid Excel file with at least one worksheet.
Invalid worksheet selectionWorksheet name does not exist or index is out of range.Use valid worksheet names or 0-based indexes.
Available worksheets in workbook (X total)Informational message appended when worksheet selection validation fails.Review worksheet names or indexes and use valid values from the X available worksheets listed.

抽出ワークシートの設定方法 Power Automate?​

  1. 追加 PDF4me → ワークシートを抽出する あなたの Power Automate 流れ。
  2. 地図 ファイルの内容 そして ファイル名 以前のアクションから、例えば SharePoint または OneDrive ファイルの内容を取得します。
  3. セット ワークシート名、 ワークシート索引両方を選択するか、両方を空白のままにしてすべてのワークシートを抽出します。
  4. フローを実行します。選択した各ワークシートの最初の行は JSON キー、そして結果は次のように返されます documentBase64エンコードされた JSON ワークシート名をキーとするオブジェクト。

ワークシート名とワークシートインデックスは、それぞれどのような場合に使い分けるべきでしょうか?​

使用 ワークシート名 対象シートに「Summary」や「ClientData」などの安定した既知の名前が付いている場合、シートの順序が変わっても選択が正しく維持されるため、これを使用します。 ワークシート索引 フローがシートの順序は予測可能だが名前が可変なワークブックを生成する場合。両方を設定すると、2つの選択範囲の和集合が抽出されるため、両者が重複しても出力にワークシートが重複して表示されません。

典型的な構成​

ワークフローの例Common Power Automate flow patterns using Extract Worksheets from Excel.
複数シートのワークブック API 餌
  1. 複数シートがトリガーされるとフローが起動します Excel ワークブックがアップロードされます SharePoint 「データエクスポート」フォルダ。
  2. ファイルコンテンツの取得はワークブックを取得します。
  3. 「ワークシート抽出」機能は、ワークシート名とワークシートインデックスの両方を空白のままにして実行し、すべてのシートを変換します。
  4. 解析 JSON 結果を処理し、Apply to each ループが各ワークシートのデータを独自の API 終点。
予定 JSON アーカイブ
  1. 繰り返しトリガーは、毎月のアーカイブフローを実行します。
  2. ファイルコンテンツを取得すると、完了したプロジェクトが取得されます。 Excel ファイルから SharePoint。
  3. Extract Worksheets は各ワークブックを JSON 全てのシートが含まれています。
  4. の JSON 出力はAzure Blob Storageに保存されます。 SharePoint 元のアーカイブファイルと並行して。
選択的なクライアントエクスポート
  1. Microsoft Formsの送信により、クライアント固有のデータのエクスポートが要求されます。
  2. ファイルコンテンツの取得は、安全な場所からマスターワークブックを取得します。 SharePoint 図書館。
  3. 「ワークシートの抽出」は、クライアントが閲覧を許可されているシートのみをワークシート名として設定して実行されます。たとえば、「Summary,ClientData」などです。
  4. 結果として JSON リクエスト者にメールで送信され、関係のない内部シートはエクスポートから完全に除外されます。

実践的なヒント​

Leave both selection fields blank for a full export
Extracting every worksheet in one call is simpler than chaining several Extract Worksheets actions when a flow needs the whole workbook as JSON.
Match Worksheet Names exactly, including case
Worksheet name comparison is case-sensitive. A mismatch returns an invalid worksheet selection error even if the name looks correct at a glance.
Remember Worksheet Indexes start at 0
Index 0 is the first sheet, not the second. Off-by-one index values are a common source of the wrong worksheet being extracted.
Combining names and indexes extracts a union, not an intersection
If a worksheet matches either list, it is included once. Use only one selection method if you need precise, predictable output.
Parse JSON before looping through worksheets
The output document decodes to an object keyed by worksheet name, so a Parse JSON action followed by Apply to each on the object's keys is the standard pattern for per-sheet processing.

チートシート​

分野価値
ActionExtract Worksheets
File ContentMapped from a prior file-retrieval action
File Namee.g. data.xlsx
Worksheet NamesComma-separated, case-sensitive, or blank
Worksheet Indexes0-based, comma-separated, or blank
Blank + blankExtracts all worksheets
Both filledUnion of name matches and index matches
Outputdocument (Base64 JSON, .txt), FileName, Success, Error Message, Errors

よくある質問​

How do I convert an Excel worksheet to JSON in Power Automate?+
Add the PDF4me Extract Worksheets action, map File Content and File Name from a prior action, then set Worksheet Names or Worksheet Indexes to choose which sheets to convert. Leaving both blank extracts every worksheet, returning a JSON document keyed by worksheet name. See the connector reference below for the full action list.
What happens if I leave Worksheet Names and Worksheet Indexes both blank?+
The action extracts every worksheet in the workbook and returns them all as JSON, one array per worksheet name in the output document. This is the simplest setup for a full workbook-to-JSON export.
Can I select worksheets by name and by index in the same request?+
Yes. If both Worksheet Names and Worksheet Indexes are provided, the action extracts the union of the two selections, so any worksheet matching either the name list or the index list is included once in the result.
Are Worksheet Indexes 0-based or 1-based?+
Worksheet Indexes are 0-based, so index 0 refers to the first worksheet, index 1 to the second, and so on. See <a href="https://learn.microsoft.com/en-us/office/dev/scripts/resources/samples/get-table-data" target="_blank" rel="noopener noreferrer">Microsoft's guide to reading Excel table data</a> for how worksheet and range indexing works natively in Excel.
What does the output JSON look like?+
The output document is a JSON object with one key per extracted worksheet name, and each key holds an array of row objects built from that sheet's header row and data rows, with numbers, dates, booleans, and text preserved in their native JSON types. See <a href="https://learn.microsoft.com/en-us/connectors/pdf4me/" target="_blank" rel="noopener noreferrer">the PDF4me Power Automate connector reference</a> for the full action list.

業界におけるユースケースとアプリケーション​

ITおよびシステム統合のユースケース

  • システム移行システム移行のためにExcelワークブック全体をJSON形式でエクスポートする
  • マルチAPI統合異なるワークシートを異なるAPIエンドポイントに送信する
  • データバックアップ複数シートのExcelファイルのJSONバックアップを作成する
  • クラウド移行ExcelワークブックをJSON形式に変換してクラウドストレージに保存する

関連アクション​

他のプラットフォームでの同じタスク​

ヘルプが必要な場合​