Ask Your Question
3

How can I retrieve the headings for a table in IMPORTXML on Google Sheets?

asked 2022-06-04 11:00:00 +0000

ladyg gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-07-18 09:00:00 +0000

lakamha gravatar image

You can retrieve the headings for a table in IMPORTXML on Google Sheets by using the XPath function //table//th in combination with the importxml function. This XPath expression selects all the th elements within the table element.

Here's an example formula that retrieves the headings for the first table on a webpage:

=IMPORTXML("https://www.example.com/", "//table[1]//th")

This formula imports the headings for the first table on the webpage "https://www.example.com/". You can modify it to select a different table by changing the index within the XPath expression [1] to the index of the table you want to select.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-06-04 11:00:00 +0000

Seen: 15 times

Last updated: Jul 18 '22