Calc - Importing tables from web pages
Importing tables from websites
To grab a table from a website isn’t terribly difficult. One can simply select the table, copy it (Ctrl + C) and paste it in your document. But especially if the page contains many tables, there is an easier way to get the tables in your LibreOffice spreadsheet.
After opening a spreadsheet in Calc, go to Sheet menu and select Link to external data. Or, if you are using the tabbed user interface, go to to the Data tab and select the Link to external data button. This will open the menu below.
Fill in the link to the web page with the tables you want to import in your spreadsheet. Let’s for example try to import the table with American movies of 2022 from Wikipedia. Fill in the link in the first field and hit Enter. This will open a Window Import options. Fill in or change the relevant fields and hit OK.
The tool will identify and list all tables on the page in the Available Tables/Ranges field. It may provide names tables, of generic names like html_1, html_2, etc. So you will have to check, and perhaps try out which tables you want.
Try to import for example the third table, HTML_3 – Highest-grossing films of 2022. You’ll see that Calc imports the table with formatting and hyperlinks.
You may want to pay attention how the function deals with merged cells, vertically aligned text and other more advanced formatting options. For those familiar Excel, the way Calc handles this more complicated layout issues may differ from how Excel deals with them.