+ Reply to Thread
Results 1 to 17 of 17

WebQuery to import data table

  1. #1
    Registered User
    Join Date
    03-30-2014
    Location
    ExcelVBA
    MS-Off Ver
    Excel 2003
    Posts
    15

    WebQuery to import data table

    In “Sheet I” cell F18, F19, F20, I have three URL (derived through formula). This refers to webpage which source code reveals that it uses XHTML format and has some java script.

    Using URL in cell F18, I want to import data table in sheet F, from Row B2
    Using URL in cell F19, I want to import data table in sheet F, from Row B102
    Using URL in cell F20, I want to import data table in sheet F, from Row B202

    Once data is imported in sheet F, all formatting and link to webpage should be removed.
    In any case such cleaning should be done within range A:Z.

    From Column AA onwards, I want to perform some calculation, which would be repetitive each time when I bring new data, it should not be disturbed.

    Likewise, there are formula based URL in Sheet I - Cell Z18, Z19, Z20 which is required to be placed in above manner but in Sheet O.

    Kindly help. Sample File attached.
    Attached Files Attached Files
    Last edited by FF RT; 04-03-2014 at 02:14 AM.

  2. #2
    Registered User
    Join Date
    03-30-2014
    Location
    ExcelVBA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: WebQeury to import data table from XHTML Javascript page

    I need a VBA Macro that could do the above

  3. #3
    Registered User
    Join Date
    03-30-2014
    Location
    ExcelVBA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: WebQeury to import data table from XHTML Javascript page

    Anybody to help ?

  4. #4
    Registered User
    Join Date
    03-30-2014
    Location
    ExcelVBA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: WebQeury to import data table from XHTML Javascript page

    Seems, Five seniors have accessed to my file, and trying to solve the issue.

    Please note that second part of the query, may please be ignored. which is

    Likewise, there are formula based URL in Sheet I - Cell Z18, Z19, Z20 which is required to be placed in above manner but in Sheet O.
    Kindly solve the first part of the issue.

  5. #5
    Registered User
    Join Date
    03-30-2014
    Location
    ExcelVBA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: WebQeury to import data table from XHTML Javascript page

    Strange, no EXPERT around for this query. I think solution is there, i just lack conceptual knowledge.

  6. #6
    Registered User
    Join Date
    03-30-2014
    Location
    ExcelVBA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: WebQeury to import data table from XHTML Javascript page

    Can Anyone please help me to get the Table Data from a Web page considering

    URL 1 is in SheetI(cell F18) and bring in data in Sheet O cell B2, and

    URL 2 is in SheetI(Cell F19) and bring in data in Sheet O Cell B100.

    Sample file attached.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-30-2014
    Location
    Suzhou,China
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: WebQuery to import data table

    I am not very clear about your problems. See if help you:

    Please Login or Register  to view this content.
    Welcome to China,Welcome to Suzhou...And,我是来学英文的。

  8. #8
    Registered User
    Join Date
    03-30-2014
    Location
    ExcelVBA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: WebQuery to import data table

    Thanks, but if u run the code, you would observe that Data that should appear in table, comes in the first line (say B2, and B100) .

    While the table structure is there, corresponding value is in first row only.

    For instance. Cell B1 value is like

    {"valid":"true","isinCode":null,"lastUpdateTime":"03-APR-2014 10:44:05","ocLink":"\/marketinfo\/sym_map\/symbolMapping.jsp?symbol=ACC&instrument=-&date=-&segmentLink=17&symbolCount=2","tradedDate":"03APR2014","data":[{"change":"-0.80","sellPrice1":"1,366.80","buyQuantity3":"250","sellPrice2":"1,366.90","buyQuantity4":"500","buyQuantity1":"250","ltp":"10.59","buyQuantity2":"250","sellPrice5":"1,367.80","sellPrice3":"1,367.00","buyQuantity5":"250","sellPrice4":"1,367.40","underlying":"ACC","bestSell":"10.46","annualisedVolatility":"38.21","optionType":"-","prevClose":"1,367.70","pChange":"-0.06","lastPrice":"1,366.90","lowPrice":"1,355.00","strikePrice":"-","numberOfContractsTraded":"978","underlyingValue":"1,358.60","openInterest":"10,68,500","impliedVolatility":"-","vwap":"1,363.37","totalBuyQuantity":"68,000","openPrice":"1,367.70","closePrice":"-","bestBuy":"8.81","changeinOpenInterest":"37,750","clientWisePositionLimits":"933162","totalSellQuantity":"58,750","dailyVolatility":"2.00","sellQuantity5":"500","marketLot":"250","expiryDate":"24APR2014","marketWidePositionLimits":"18663247","sellQuantity2":"500","sellQuantity1":"250","buyPrice1":"1,365.50","sellQuantity4":"500","buyPrice2":"1,365.15","sellQuantity3":"250","buyPrice4":"1,364.40","buyPrice3":"1,365.10","buyPrice5":"1,364.30","turnoverinRsLakhs":"3,333.44","pchangeinOpenInterest":"3.66","settlementPrice":"1367.70","instrumentType":"FUTSTK","highPrice":"1,373.10"}],"companyName":"ACC Limited","eqLink":"\/live_market\/dynaContent\/live_watch\/get_quote\/GetQuote.jsp?symbol=ACC"}


    Open the url in browser, and have a look at the webpage, how data is organised.

    Normally, if HTML page is being in place, above code would work with no problem, but because the URL (Link) is in xhtml, or having some Java variables, this problem is coming.

    Kindly help.
    Last edited by FF RT; 04-03-2014 at 02:55 AM.

  9. #9
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: WebQuery to import data table

    maybe you can adjust this to suit
    The span tags in the table is allow the java script to run .. it references a array
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  10. #10
    Registered User
    Join Date
    03-30-2014
    Location
    ExcelVBA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: WebQuery to import data table

    Thanks for help, Brother.

    Two things to say,

    1) When I run this macro, i get Compile Error - "User Defined type not defined" at line

    Please Login or Register  to view this content.
    and

    2) Can following macro code line be changed suitably, so that the URL is read from a specific Cell, instead of within macro, to keep it flexible?

    Please Login or Register  to view this content.

  11. #11
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: WebQuery to import data table

    Hi
    Forgot to say that you have to add a MSXML2.XMLHTTP library
    so in the VBE > Tools> References > "Microsoft HTML object Library"

    values will be printed to the intermediate window

  12. #12
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: WebQuery to import data table

    In a hurry. Quick reply.

    1. You are missing a reference library. Google HTMLDocument to find out what reference library you need to add to your project. (At a guess I'd say 'Microsoft HTML Objects Library' )

    2. Yes it can. Give your desired input cell a name (so it's a named range) and then read the named range as a string. Replace the URL with the string variable.
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  13. #13
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: WebQuery to import data table

    cross-post without supplying a link to the duplicate question on the other forum.

  14. #14
    Registered User
    Join Date
    03-30-2014
    Location
    ExcelVBA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: WebQuery to import data table

    Quote Originally Posted by pike View Post
    Hi
    Forgot to say that you have to add a MSXML2.XMLHTTP library
    so in the VBE > Tools> References > "Microsoft HTML object Library"

    values will be printed to the intermediate window
    Thanks, I activated the same.

    But now, end result is nothing. Code gets executed without any error, but i find nothing on excelsheet??? where data have gone?

    cross-post without supplying a link to the duplicate question on the other forum.
    Just had word with a friend, who is working with me for similar thing.

  15. #15
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,870

    Re: WebQuery to import data table

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  16. #16
    Registered User
    Join Date
    03-30-2014
    Location
    ExcelVBA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: WebQuery to import data table

    Apology, Will not happen again.

  17. #17
    Registered User
    Join Date
    03-30-2014
    Location
    ExcelVBA
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: WebQuery to import data table

    If possible, kindly delete this thread, as thread on identical issue was initiated by my friend at ozgrid forum also, where it is partially, resolved. (http://www.ozgrid.com/forum/showthre...777#post708777).

    Thanks, and sorry for the inconvenience.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. import web query from javascript search output
    By Champstaff in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-20-2013, 08:16 AM
  2. Import table from a web page
    By RuiC. in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-03-2013, 06:15 PM
  3. Replies: 1
    Last Post: 09-20-2012, 11:51 AM
  4. How to import a table on a Web page to Excel?
    By Dmitry Kopnichev in forum Excel General
    Replies: 8
    Last Post: 11-11-2005, 06:30 AM
  5. [SOLVED] How to import a table on a Web page to Excel?
    By Dmitry Kopnichev in forum Excel General
    Replies: 8
    Last Post: 11-11-2005, 06:30 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1