複数ブックのデータを集約する
Folder.GetSpecialFolder SpecialFolder: Folder.SpecialFolder.DesktopDirectory SpecialFolderPath=> myDesktopPath Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''%myDesktopPath%\\sketoFile\\PAD\\売上データまとめ.xlsx''' Visible: True ReadOnly: False Instance=> mainExcelFile Folder.GetFiles Folder: $'''%myDesktopPath%\\sketoFile\\PAD\\売上データ''' FileFilter: $'''*支店*xlsx''' IncludeSubfolders: False FailOnAccessDenied: True SortBy1: Folder.SortBy.NoSort SortDescending1: False SortBy2: Folder.SortBy.NoSort SortDescending2: False SortBy3: Folder.SortBy.NoSort SortDescending3: False Files=> Files LOOP FOREACH excelFile IN Files Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: excelFile Visible: True ReadOnly: False Instance=> sitenExcelFile Excel.GetFirstFreeColumnRow Instance: sitenExcelFile FirstFreeColumn=> sitenFirstFreeColumn FirstFreeRow=> sitenFirstFreeRow Excel.CopyCellsFromExcel.CopyCells Instance: sitenExcelFile StartColumn: 1 StartRow: 2 EndColumn: sitenFirstFreeColumn - 1 EndRow: sitenFirstFreeRow - 1 Excel.GetFirstFreeColumnRow Instance: mainExcelFile FirstFreeColumn=> mainFirstFreeColumn FirstFreeRow=> mainFirstFreeRow Excel.PasteCellsToExcel.PasteAt Instance: mainExcelFile Column: 1 Row: mainFirstFreeRow Excel.CloseExcel.Close Instance: sitenExcelFile END UIAutomation.FocusWindow.FocusByInstanceOrHandle WindowInstance: mainExcelFile Display.ShowMessageDialog.ShowMessage Title: $'''メッセージ''' Message: $'''データ集約完了しました。''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> ButtonPressed # [ControlRepository][PowerAutomateDesktop] { "ControlRepositorySymbols": [], "ImageRepositorySymbol": { "Name": "imgrepo", "ImportMetadata": {}, "Repository": "{\r\n \"Folders\": [],\r\n \"Images\": [],\r\n \"Version\": 1\r\n}" } }
指定した見出し名がExcelデータ何列目かを取得
Folder.GetSpecialFolder SpecialFolder: Folder.SpecialFolder.DesktopDirectory SpecialFolderPath=> myDesktopPath Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''%myDesktopPath%\\sketoFile\\PAD\\宛先一覧.xlsx''' Visible: True ReadOnly: False Instance=> mainExcelFile Excel.GetFirstFreeColumnRow Instance: mainExcelFile FirstFreeColumn=> FirstFreeColumn FirstFreeRow=> FirstFreeRow Excel.ReadFromExcel.ReadCells Instance: mainExcelFile StartColumn: 1 StartRow: 1 EndColumn: FirstFreeColumn - 1 EndRow: FirstFreeRow - 1 ReadAsText: False FirstLineIsHeader: True RangeValue=> ExcelData SET clmHeader TO ExcelData.ColumnHeadersRow.ColumnNames Display.SelectFromListDialog.SelectFromList Title: $'''入力フォーム''' Message: $'''検索する見出し名を入力してください。''' List: clmHeader IsTopMost: True AllowEmpty: False SelectedItem=> SelectedItem SelectedIndex=> SelectedIndex ButtonPressed=> ButtonPressed2 LOOP LoopIndex FROM 1 TO FirstFreeColumn - 1 STEP 1 IF clmHeader[LoopIndex - 1] = SelectedItem THEN SET clmIndex TO LoopIndex EXIT LOOP END END Display.ShowMessageDialog.ShowMessage Title: $'''Excelデータの見出し''' Message: $'''『%SelectedItem%』は%clmIndex%列目の見出し名です。''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> ButtonPressed
【PAD他テンプレート】
本番環境ではこちらにPADフローのその他カテゴリー一覧が表示されます。