As we all know, Google Docs is an online word processor that lets you create and format text documents and collaborate with other people in real time. Here's what you can do with Google Docs:
- Upload a Word document and convert it to a Google document
- Add flair and formatting to your documents by adjusting margins, spacing, fonts, and colors — all that fun stuff
- Invite other people to collaborate on a document with you, giving them edit, comment or view access
- Collaborate online in real time and chat with other collaborators — right from inside the document
- View your document's revision history and roll back to any previous version
- Download a Google document to your desktop as a Word, OpenOffice, RTF, PDF, HTML or zip file
- Translate a document to a different language
- Email your documents to other people as attachments
But how to Import Web Data into Google Docs?
Google Sheets is an online spreadsheet app that lets you create and format spreadsheets and simultaneously work with other people. Here's what you can do with Google Sheets:
- Import and convert Excel, .csv, .txt and .ods formatted data to a Google spreadsheet
- Export Excel, .csv, .txt and .ods formatted data, as well as PDF and HTML files
- Use formula editing to perform calculations on your data, and use formatting make it look the way you'd like
- Chat in real time with others who are editing your spreadsheet
- Create charts with your data
- Embed a spreadsheet — or individual sheets of your spreadsheet — on your blog or website
Today we’ll discuss ImportHTML, a useful Google formula that will help you fetch tables and lists from an external web pages into a Google Sheet.
Syntax: ImportHtml(URL, query, index)
URL is the URL of the HTML page.
Query is either “list” or “table” indicates what type of structure to pull in from the webpage. If it’s “list,” the function looks for the contents of <UL>, <OL>, or <DL> tags; if it’s “table,” it just looks for <TABLE> tags.
Index is the 1-based index of the table or the list on the source web page. The indices are maintained separately so there might be both a list #1 and a table #1.
Example: =ImportHtml(“http://en.wikipedia.org/wiki/Demographics_of_Italy“; “table”;4). This function returns demographic information for the population of Italy.
Note: The limit on the number of ImportHtml functions per spreadsheet is 50.
Let’s start with an example. Open a new spreadsheet inside Google Docs, double-click any cell to enter the Edit mode and copy-paste the following function:
=ImportHTML("http://http://en.wikipedia.org/wiki/Demographics_of_Italy", "table", 2)
When you press Return, Google Docs will instantly import the second table from the corresponding Wikipedia page into your current sheet. (You can replace the value of the third parameter in the formula, for example from 2 to 4, and Google Docs will import the forth table.
You can also import HTML lists into Google Sheets that are created using the <ol> or <ul> tags:
=ImportHTML("http://www.labnol.org/internet/tips-for-tech-startups/19483/", "list", 2)
The ordered HTML list can be imported the into your Google Sheet with one formula. If there are multiple lists on a page, you can change the third parameter.
IMPORTANT: once a table or list has been imported into Google Docs, the table won’t update itself even if the data on the source page has changed. Furthermore, Google imports the tables as plain text and all the formatting and links will be lost.
VIDEO TUTORIAL: Import HTML in Google Docs