Hi @PowerAppsUser99 I hope you are doing well.
Yes, totally agree with @Deenuji , there are multiple ways to accomplish this task, hence we are using different approaches.
Here below you will find the snipped code of another, this one will Launch the URL and create an spreadsheet right away with the main data, once created, we are reading the spreadsheet data and merging every number with the unique URL (after reviewing multiple URLs, I found out they are the same, hence we can concatenate the number with the URL.
Here is the code snipped:
SET URL TO $'''https://www.osha.gov/ords/imis/establishment.inspection_detail?id='''
WebAutomation.LaunchChrome.LaunchChrome Url: $'''https://www.osha.gov/ords/imis/establishment.search?establishment=USA&state=all&officetype=all&office=all&sitezip=100000&startmonth=01&startday=01&startyear=2023&endmonth=12&endday=31&endyear=2023&p_case=all&p_violations_exist=yes&p_start=&p_finish=0&p_sort=12&p_desc=DESC&p_direction=Next&p_show=20''' WindowState: WebAutomation.BrowserWindowState.Maximized ClearCache: False ClearCookies: False WaitForPageToLoadTimeout: 60 Timeout: 60 BrowserInstance=> Browser
WebAutomation.ExtractData.ExtractHtmlTableInExcel BrowserInstance: Browser Control: $'''html > body > div:eq(2) > div > header > div:eq(4) > div > div:eq(4) > table''' ExtractionParameters: {[$''' ''', $'''#''', $'''Activity''', $'''Date Opened''', $'''RID''', $'''ST''', $'''Type''', $'''Scope''', $'''SIC''', $'''NAICS''', $'''Violations''', $'''Establishment Name'''], [$'''''', $'''''', $'''''', $'''''', $'''''', $'''''', $'''''', $'''''', $'''''', $'''''', $'''''', $''''''] } PostProcessData: False TimeoutInSeconds: 60 ExcelInstance=> ExcelInstance
Excel.Attach DocumentName: $'''Book1''' Instance=> ExcelInstance
Excel.ReadFromExcel.ReadAllCells Instance: ExcelInstance ReadAsText: False FirstLineIsHeader: False RangeValue=> ExcelData
LOOP FOREACH CurrentItem IN ExcelData
Excel.GetFirstFreeRowOnColumn Instance: ExcelInstance Column: $'''A''' FirstFreeRowOnColumn=> FirstFreeRowOnColumn
Text.Trim Text: CurrentItem[2] TrimOption: Text.TrimOption.Both TrimmedText=> TrimmedText
Excel.WriteToExcel.WriteCell Instance: ExcelInstance Value: $'''%URL%%TrimmedText%''' Column: $'''A''' Row: FirstFreeRowOnColumn
END
Excel.ResizeColumnsOrRows.AutofitRangeOfColumns Instance: ExcelInstance StartColumn: $'''A''' EndColumn: $'''D'''
PS: the Number contains blank spaces, hence I’m using the trim action to clean the number prior to merge it.
Please let me know if it works, happy automation!,
If I have addressed your inquiry successfully, kindly consider marking my response as the preferred solution. If you found my assistance helpful, a 'Thumbs Up' would be greatly appreciated.
Additionally, I offer specialized consultancy and development services leveraging PAD. If you're interested in exploring these services further, feel free to DM me, and we can initiate a discussion.
Kind regards,
Will SG
Managing Director & Automation Lead
RAMS CR (Recruitment & Automation)
LinkedIn Profile