Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find out what index is the table I want to import from a web page?

Need some help with importhtml() function as I am trying to import table from html that has many tables. Its syntax is this:

IMPORTHTML(url, query, index)

What I don't understand is how can I find out what index is the table I want to import from HTML? Shouldn't there be an attribute for table element that says: OK, you are table number 8 on this page. I doubt I have go through entire html and count how many tables there are before the one I need.

Basically, I need to find out on what should I be concentrating on when going through html which hold desired table.

like image 902
Japo Japic Avatar asked Mar 10 '23 19:03

Japo Japic


1 Answers

From the web page, from google developers console enter below to find table numbers


var i = 1; [].forEach.call(document.getElementsByTagName("table"),
   function(x) { console.log(i++, x); });

var i = 1; [].forEach.call(document.getElementsByTagName("list"), 
   function(x) { console.log(i++, x); });
like image 165
Ed Nelson Avatar answered Apr 26 '23 02:04

Ed Nelson