p6l-richard
p6l-richard

Reputation: 409

IMPORTXML(): Empty content even though xpath works

I want to import data from a website to a google spreadsheet.

The Site containing data.

It tried it in the scrapy shell and it works: enter image description here

Also, the source code clearly shows the content, meaning that it is not fetched by JavaScript (correct?): enter image description here

When I start the scrapy shell and call the command response(view) (this actually shows the file how scrapy sees it) it shows the complete content so I'm pretty sure it's not related to JavaScript.

I don't know if it might be jQuery or Ajax or anything else. This question suggested also the RSS Feed. In the case of the above website this unfortunately doesn't work.

Does anybody figure out what's going wrong?

Here are the gSheet formulae that I've tried:

=IMPORTXML("https://www.feiertagskalender.ch/index.php?geo=3058&klasse=3&hl=en","//div[@class='list-group']//a/div[1]/text()")
=IMPORTXML("https://www.feiertagskalender.ch/index.php?geo=3058&klasse=3&hl=en","//div[@class='list-group']//a/div[1]")
=IMPORTXML("https://www.feiertagskalender.ch/index.php?geo=3058&klasse=3&hl=en","//div[@class='list-group']//a/div/text()")
=IMPORTXML("https://www.feiertagskalender.ch/index.php?geo=3058&klasse=3&hl=en","//div[@class='list-group']//a/div")

All of return the message

N/A Imported content is empty

Upvotes: 0

Views: 694

Answers (1)

Tanaike
Tanaike

Reputation: 201338

For example, how about this? The valuers are directly retrieved using "//div[@class='col-md-3 black-link']". https://www.feiertagskalender.ch/index.php?geo=3058&klasse=3&hl=en is in a cell of "A1".

=IMPORTXML(A1, "//div[@class='col-md-3 black-link']")

enter image description here

Note :

  • In this site, "März 2018", "Mai 2018", "Juni 2018" and "Oktober 2018" which are in your question were not found.

If this was not useful for you, I'm sorry.

Upvotes: 1

Related Questions