0

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

Community
  • 1
  • 1
p6l-richard
  • 321
  • 2
  • 11

1 Answers1

1

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.

Tanaike
  • 181,128
  • 11
  • 97
  • 165
  • The answer is correct and works. But I still don't understand why my formulae wouldn't work if the xpath is correct. Do you have any idea? – p6l-richard Jan 19 '18 at 17:46
  • @RichardPoe I have ever experienced that the difference results are obtained for each user with the same XPath. At that time, it was found that the values depend on the access area. I don't know whether your case is the same to that. If this information was not useful for you, I'm sorry. – Tanaike Jan 19 '18 at 23:06