Search code examples
web-scrapinggoogle-sheetsxpathimportgoogle-query-language

Facing a difficulty in importhtml function, using order by and select col function but header is also being affected while importing in google sheets


I am using this function =QUERY(INDEX(SUBSTITUTE(IMPORTHTML (I2 & "?refresh=" & I6,I3,I4), "*", )), "SELECT Col1, Col2, Col3, Col4 ORDER BY Col1 ASC")

This is returning data with the headers in between the table.

Also, can we use offset to avoid headers at all, if yes what would be proper syntax Link to importing page

https://www.ipowatch.in/p/ipo-subscription-numbers-status.html


Solution

  • try:

    =QUERY(INDEX(SUBSTITUTE({
     IMPORTHTML(I2&"?refresh="&I6, I3, I4), 
     IMPORTHTML(I2&"?refresh="&I6, I3, I5)}, "*", )), 
     "select Col1,Col2,Col3,Col4,Col6,Col7 order by Col1", 1)
    

    enter image description here

    demo sheet