Google Sheets – How to Query Data Using ImportHTML Function

google sheetsgoogle-sheets-queryimporthtml

I am trying to import table data into a Google spreadsheet using the below function:

=ImportHTML( "http://eciresults.nic.in/StatewiseU05.htm" , "table" , 9 )

Following is the result I get out of it.

Screenshot of table result

But I didn’t want the content in row 1,2,3 & 4 to be displayed so I tried the query as following and got the below result:

=QUERY(ImportHTML( "http://eciresults.nic.in/StatewiseU05.htm" , "table" , 9 ), "SELECT * OFFSET 0")

Screenshot 2

But I’m still getting the NCT of Delhi content in row 1. How can I get rid of that and show only row 2 and onwards that contains the area name and subsequent data?

Best Answer

I got it to work with this:

=QUERY(ImportHTML( "http://eciresults.nic.in/StatewiseU05.htm" , "table" , 9 ), "SELECT * where Col2>0",0)