I am trying to import Dividend data of a stock into a google sheet but I am getting error stating that could not fetch URL but if I tried to connect to the NASDAQ website manually then its working perfectly. I am not sure what's causing this issue.
Your help is highly appreciated.
Query Used
=QUERY(IMPORTHTML("https://www.nasdaq.com/symbol/aapl/dividend-history", "table", 3), "select Col3")
Error
Could not fetch url: https://www.nasdaq.com/symbol/aapl/dividend-history
This may be a bug
This looks like it may be a issue on Google's side:
https://issuetracker.google.com/175144626
There has not been any resolution, but go and star that issue if it affects you or you want updates.
I found that string but it doesn't work either:
=QUERY(IMPORTXML(CONCATENATE("https://www.nasdaq.com/market-activity/stocks/"&A2&"/dividend-history");"//tbody//tr[1]"); "select Col1, Col3 LIMIT 1")
It should return the Ex-Div Date and the next quarterly Dividend amount.
Related
I am trying to import data from different GOOGLE sheets with the below formula, suggesting the correct formula getting Error "AS Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: Col18. Please guide for correct formula" & "In ARRAY_LITERAL, an Array Literal was missing values for one or more rows."
=Query({IMPORTRANGE("1srpJok8Clb_hIW0mVfx74VjrAOmGmHXavXFZ1H77pnQ","Daily DPS Delhi!A4330:R");IMPORTRANGE("1__6apvi3ICKaMQz7R4SNzm_KXtCIERavBTxQ8Dkf1bs","Trip Data!A174295:R");IMPORTRANGE("1r3CbiyP_AFcpvm4eNvJO_VvNWZjxkrIHdiOgGhyLZQg","DPS Bangalore!A20640:R")},"Select Col1,Col18,Col7,Col11,Col12 where Col1 is not null")
=QUERY({
IMPORTRANGE("1srpJok8Clb_hIW0mVfx74VjrAOmGmHXavXFZ1H77pnQ","Daily DPS Delhi!A4330:R");
IMPORTRANGE("1__6apvi3ICKaMQz7R4SNzm_KXtCIERavBTxQ8Dkf1bs","Trip Data!A174295:R");
IMPORTRANGE("1r3CbiyP_AFcpvm4eNvJO_VvNWZjxkrIHdiOgGhyLZQg","DPS Bangalore!A20640:R")},
"select Col1,Col18,Col7,Col11,Col12
where Col1 is not null")
the formula is ok but you need to run each importrange separately and allow access to connect all spreadsheets. only then you can use this formula
I'm trying to import some stock data regarding dividend history using Google Sheets.
The data I'm trying to grab is from this page: https://www.dividendinvestor.com/dividend-quote/
(e.g. https://www.dividendinvestor.com/dividend-quote/ibm or https://www.dividendinvestor.com/dividend-quote/msft)
With other sites, I've been able to use a combination of INDEX and IMPORTHTML to get data from a table. For example, if I wanted to get the "Forward P/E" for IBM from finviz.com, I do this:
=index(IMPORTHTML("http://finviz.com/quote.ashx?t=IBM","table", 11),11,10)
That grabs table 11 and goes down 11 rows and over 10 columns to get the piece of data that I want.
However, I cannot seem to find any tables to import via IMPORTHTML from the www.dividendinvestor.com/dividend-quote/ibm site.
I'm trying to import the value to the right of the "Consecutive Dividend Increases" field.
In this case, the output I'm trying to achieve is "19 years".
I've also tried IMPORTXML, but everything I try with XPATH (using this path: "/html/body/div[3]/div/div/div[2]/div/div/div[2]/div[2]/div[2]/span[20]" ) fails too.
Any help out there? The desired end result will be that I will dynamically build the dividendinvestor.com URL by appending a different ticker symbol and have a result of how many years of consecutive increases in their dividend payout.
Nice solution proposed by #player0. If you don't want to use INDEX, you can go with :
=IMPORTXML("https://www.dividendinvestor.com/dividend-quote/"&B3,"//a[.='Consecutive Dividend Increases']/following::span[1]")
Update (May 2022) :
New working formula :
=REGEXEXTRACT(TEXTJOIN("|";TRUE;IMPORTXML("https://www.dividendinvestor.com/ajax/?action=quote_ajax&symbol="&B2;"//text()"));"\d+ Years")
Note : I'm based in Europe, so semi-colons may have to be replaced with commas.
try:
=INDEX(IMPORTXML("https://www.dividendinvestor.com/dividend-quote/ibm/",
"//span[#class = 'data']"), 9, 1)
could you please give me an idea about how I can get thi
Many sites go to great lengths to actively prevent scraping. Giving you just the data you want entirely undermines their business model. If you're a consumer, they're denied the chance to show you advertising. If you're a reseller, you can use fairly simple programming and marketing to undercut their prices.
If you find yourself unable to scrape, it may be because it's not going to be possible.
unfortunately, that won't be possible because the site is controlled by JavaScript and Google Sheets can't understand/import JS. you can test this simply by disabling JS for a given link and you will see a blank page:
A workaround. You can import the data with the following script (credits to Brad Jasper) : ImportJSON, then request with QUERY formula. This is an example with "iPhone 8" and "Playstation 4".
In column A, you write the product to search. The url to get the JSON data is automatically build in column B with a concat operator.
="https://wss2.cex.uk.webuy.io/v3/boxes?q="&A2
In column C, you have the QUERY formula combined with the ImportJSON data step.
=QUERY(ImportJSON(B2);"SELECT Col4,Col20 WHERE Col4 CONTAINS 'Plus' AND Col4 CONTAINS '64' AND Col4 CONTAINS 'Unlocked' LIMIT 1 label Col4'',Col20''";1)
Col4 : product description, Col20 : price of the product. Since the JSON will return a lot of results (multiple iPhone 8 versions), this is the step where you can refine your search. I've searched for "Plus","64" and "Unlocked" in the product description.
I spend hours trying to fix this but can't find where the issue is.
I try to import data in google spreadsheet using importxml.
Here is the url :
http://www.journaldesfemmes.com/maman/creches/3-pom/creche-3098
I'm interested in exctracting email and phone number for exemple. I used chrome inspector to copy the Xpath, and few chrome plugins. I guess the issu is the Xpath. Here is the formula I used in spreadsheet :
=importxml("http://www.journaldesfemmes.com/maman/creches/3-pom/creche-3098";"/html/body/div[4]/div/div[1]/div[2]/div[1]/div/div/div/div/div[10]/table/tbody/tr[2]/td[2]")
Hope someone can help
Since the data you want is in tables, it might be easier to use importhtml.
The table you want you can get with this:
=IMPORTHTML("http://www.journaldesfemmes.com/maman/creches/3-pom/creche-3098","table",2)
To get just the phone number add index (row and column of table)
=index(IMPORTHTML("http://www.journaldesfemmes.com/maman/creches/3-pom/creche-3098","table",2),3,2)
email is:
=index(IMPORTHTML("http://www.journaldesfemmes.com/maman/creches/3-pom/creche-3098","table",2),4,2)
Can somebody explain me how to properly sort "[Arrivals] group" by Count(SearchDate)] for particular "Departure" in this Matrix?
I tried this fx in Row Group Sorting Properities, but it didn't work.
[Count(SearchDate)]
Then I tried specify which column I would like to sort, but same problem.
=Count(IIF(Fields!Departures.Value = "PRG", 1, 0))
After deeper inspection I found that I am able to sort "[Arrivals] group" only by [Count(SearchDate)] but not grouped for particular "Departure".
After a advice in MSDN forum I tried this fx:
=IIF(Fields!Departures.Value = "PRG", Count(Fields!SearchDate.Value), 0)
In first view result looks good but only for the first couple of records.
When I tried pivot table in SQL server everything looks fine:
SELECT * FROM (SELECT Arrivals, Departures, SearchDate FROM Destination WHERE SearchDate > '2016-03-01T00:00:00' AND SearchDate < '2016-03-28T14:03:46') as a
PIVOT (COUNT(SearchDate) for Departures in (PRG, LON)) as PivotTable
Order by PRG Desc
I spent a lot of time and tried a lot of solution but I have realy no idea how to solve it.
Thank you very much for your help, Petr.
I faced the same problem before. Try using this expression:
=COUNT(
IIF(
Fields!Departures.Value="PRG",
COUNT(Fields!SearchDate.Value),
Nothing
)
)
It could be a pain since depending on the dataset number of rows it increases the report processing time causing poor performance, it works though.
Let me know if this helps.