I am getting stock news data from a website and am changing the source dynamically by changing the ticker symbol entered in a cell. Depending on the ticker symbol, the table needed from the webpage may be table 0,1,2,3 or 4. If it is the wrong table, it errors. I added a way I can toggle between the Numbers to import the results "Tbl" but you have to manually change the cell value in excel and refresh until it no longer errors and imports the desired table.
Not sure how to do it but is there a way to write in the m code to automatically check each table until it finds the table without error? If then else?
Here are two links to try
Here is the code currently
"News" is linked to a cell to change the ticker symbol
"Tbl" is linked to a cell to change the table #
News=Excel.CurrentWorkbook(){[Name="News"]}[Content]{0}[Column1],
Tbl=Excel.CurrentWorkbook(){[Name="Table"]}[Content]{0}[Column1],
Source = Web.Page(Web.Contents(News)),
Data3 = Source{Tbl}[Data],
Not sure how to do it but is there a way to write in the m code to automatically check each table until it finds the table without error? If then else?
Here are two links to try
ICU - SeaStar Medical Holding Corp Stock Price and Quote
ICU - SeaStar Medical Holding Corp - Stock screener for investors and traders, financial visualizations.
elite.finviz.com
AMZN - Amazon.com Inc. Stock Price and Quote
AMZN - Amazon.com Inc. - Stock screener for investors and traders, financial visualizations.
elite.finviz.com
"News" is linked to a cell to change the ticker symbol
"Tbl" is linked to a cell to change the table #
News=Excel.CurrentWorkbook(){[Name="News"]}[Content]{0}[Column1],
Tbl=Excel.CurrentWorkbook(){[Name="Table"]}[Content]{0}[Column1],
Source = Web.Page(Web.Contents(News)),
Data3 = Source{Tbl}[Data],