You may want to have in Excel some contents from the Internet. In some case, the basic functionalities of Excel / LibreOffice will be enough to get the data, but in most of the case, you will need more complex processing. So I wrote a simple script that will scrap the content with regular expression, xpath or css selector, and expose the results in a very simple API so that Excel / LibreOffice will be able to use it.

The script is available on github.com/rpeyron/scrap2api/ with full documentation.

A simple example to get the number of results of a google search with the different methods is provided (replace /path-to/scrap.php with the path where you have put the scrap.php script on your PHP webserver)

  • See the result in your browser: /path-to/demo/scrap.php/google-numresults-css/test?token=test
  • Get the result in Excel / LibreOffice, use formula : =WEBSERVICE("/path-to/scrap.php/google-numresults-css/test?token=test") or in French editions : =SERVICEWEB("/path-to/scrap.php/google-numresults-css/test?token=test")
  • See the Swagger UI of the definition of the API : /path-to/scrap.php/openapi-ui

The script is also extensible through plugins, please refer to developer’s documentation.