2

i looked the existing questions (such as this one: Get data from webpage using Google Apps Script and Yahoo Query Language) which are similar to my query but had no luck.

How do i get data from bseindia.com using UrlFetchApp? Here is the page: http://www.bseindia.com/stock-share-price/stockreach_financials.aspx?scripcode=532343&expandable=0

Now, for example, How do i get the Revenue of Dec 14 from the above page? In this case, the code should return 2,652.91.

i tried this:

    function getit(){
    var response = UrlFetchApp.fetch("http://www.bseindia.com/stock-share-price/stockreach_financials.aspx?scripcode=532343&expandable=0");
    var cut = response.substring(str.indexOf("<td class=TTRow_right>"),response.length);
    var value = cut.substring(0, cut.indexOf("</td>"));
    Logger.log(number);
    }

The error i get is: TypeError: Cannot find function substring in object

what i am doing is definitely not correct also because every revenue number in there starts with the same "td class=TTRow_right"

user1327454
  • 145
  • 3
  • 16
  • Have you tried anything so far? Please post your attempt so we can try and help you out accordingly. This question is too broad and shows no effort on your end. Please take a look at [this](http://stackoverflow.com/questions/22282344/google-app-script-extracting-data-from-website) as it might be able to help you out further. – pointNclick Jul 24 '15 at 17:00

1 Answers1

0

The response you are getting is not a string but of type HTTPResponse, so you cannot use substring(..) on it. Try response.getContentText()

you find more details here http-response