-2

I want to import table in "https://www.screener.in/screens/1/The-Bull-Cartel/" to my Google sheets. I tried to use IMPORTDATA, IMPORTHTML but it didn't work. I understand that the tables are of Javascript. I don't know about Java or code and I am really trying to learn. Kindly help me with the procedure for importing data.

The formulas that i used areIMPORTDATA("https://www.screener.in/screens/1/The-Bull-Cartel/")  which resulted in some java type output and it looks like this

other isIMPORTHTML("https://www.screener.in/screens/1/The-Bull-Cartel/","table",1)  which give error "imported content is empty".

user9378515
  • 7
  • 1
  • 5
  • Show formulas you tried, etc. – tehhowch Mar 07 '18 at 15:05
  • The formulas that i used areIMPORTDATA("https://www.screener.in/screens/1/The-Bull-Cartel/") which resulted in some java type output and other isIMPORTHTML("https://www.screener.in/screens/1/The-Bull-Cartel/","table",1) which give error "imported content is empty". – user9378515 Mar 07 '18 at 15:06
  • Those should be a part of your question and not a comment. – tehhowch Mar 07 '18 at 17:20
  • @tehhowch Thank you for your suggestion. I edited as you told. Kindly help me. – user9378515 Mar 07 '18 at 17:23
  • What does the "java type output" look like? A screenshot of the cell would be a great addition to your question. Also, did you try other table indices? – tehhowch Mar 07 '18 at 17:27
  • @tehhowch I tried uploading it's showing I don't have 10 reputation points to post images. Instead I posted link. I tried from 0 to 10 number in IMPORTHTML function after "table" but all comes same "imported content is empty". – user9378515 Mar 07 '18 at 17:35

2 Answers2

3

The reason IMPORTHTML fails to import the table is because that "table" is dynamically supplied by the website. If you view the page source for https://www.screener.in/screens/1/The-Bull-Cartel/, you'll note that there are no table or list elements present. Those elements are required for the IMPORTHTML function to work.

Similarly, IMPORTDATA requires you point it at a comma or tab-separated file.

Summary: the website you want to scrape does not support scraping in the manner needed by Google Sheet's 'import__' formulas.

You'll have to communicate with the website owners to find out how you can legally acquire the data they display.

Community
  • 1
  • 1
tehhowch
  • 9,645
  • 4
  • 24
  • 42
  • Thank you for your time and for your reply. Actually i can able to copy the data and paste it in Google sheets. Then the link addresses inside the table are also copied. But I want to do it automatically. Is there no other way? Do UrlFetchApp in Google appscript will not work? – user9378515 Mar 07 '18 at 21:54
  • Is there any way I can use solution in https://stackoverflow.com/questions/32020041/importing-javascript-table-into-google-docs-spreadsheet to solve my problem?I can't able to understand how I convert my url to JSON type of url as show in solution in that link (var url =) – user9378515 Mar 07 '18 at 22:04
  • That solution was offered because the website in question for that answer offered a JSON file of data. The website you want to get data from might. You will have to **contact your desired website** in order to find out how they are willing to allow you programmatic access. They may say "No." – tehhowch Mar 07 '18 at 22:07
  • First of all sorry if you feel that I am stubborn. I am really trying hard to get a solution. I don't think they will reply even if I contact. But that website is not secretive. They even provide csv file in some cases like https://www.screener.in/company/BPCL/. Kindly see if information in https://github.com/Mittal-Analytics/Screener.in/blob/master/README.md is anyway useful for my problem. As I am completely unaware of programming I can't able to understand anything in that link. – user9378515 Mar 07 '18 at 22:23
-3

https://blog.coupler.io/googlefinance-function-advanced-tutorial/#How_to_get_dividend_data_and_options_from_stocks_using_GOOGLEFINANCE_function

inspired this: =importxml(concatenate("https://www.google.com/finance/quote/",concatenate(index(split(C34, ":"), 0, 2),":",index(split(C34, ":"), 0, 1))),"/html/body/c-wiz/div/div[3]/main/div[3]/div[2]/div[1]/div[7]/div[2]")

Where c34 is a reference to a goolgefinance formated symbol e.g. nasdaq:msft

The above pulls the annual div%

yes
  • 1