Cara menggunakan import html google docs

Cara menggunakan import html google docs


Google Docs is a very flexible word processor in several ways, but what some people don't know is that you can embed HTML into a Google Doc.

There are 3 ways to do this. One is copying an HTML document directly from a browser and pasting it into a Google Doc. The other is a trick using the HTML import function in Google Sheets to customize the HTML formatting that you can then embed into a Google.The third one, using Word.

1. Embed an HTML page in a Google Doc

If you are preparing a document that requires information from the web, the last thing you want to do is paste that information as text.

This is because most online data contains information such as tables, graphs, images and more. For example, taking notes for research on an essay would be much easier if you could embed HTML into a Google doc from a web page.

Fortunately, doing this in Google Docs is very easy. It's simplified by the fact that Google Docs will automatically insert pasted web pages to include the original formatting, where possible.

Select the section of the web page you want to include in your document. Press Ctrl-C on the keyboard to copy that section.

Then, open the Google document you want to embed that HTML page in, right-click and select Paste. Be sure to select Paste and not Paste without formatting.

When you select Paste, Google Docs will automatically import the section of the page you've copied as much as possible into the formatting that appears on the original page. This includes images, URL links and headers.

You can check that the links are live by hovering over them. In Google Docs you'll see the external link appear.

In some cases the image format (such as the alignment on the page) may not match the original page from which it was copied.

2. Embed HTML in Google Doc with importHtml

Another method to embed HTML into your Google document is to embed the HTML into Google Sheets using the importHtml function. Then you can insert it into Google Docs.

Note that instead of embedding a section of the page, this function will insert the entire page. However, there is a way to avoid this by using an index number in the syntax of the function to import only one table or list on the page.

For example, let's say you want to embed the fourth table from the Wikipedia website on US demographics. First, open a new Google Sheets spreadsheet. In the first cell of the spreadsheet, type the function:

=ImportHTML("https://en.wikipedia.org/wiki/Demographics_of_the_United_States", "table", 4)

When you press Enter, this will import the fourth table of the web page and insert it in the table where the cursor is.

You now have the imported HTML data that you can use to embed in Google Docs. Format this table as you want it to look in Google Docs.

- To do this, select the table in Google Sheets and press Ctrl-C to copy the table.

- Place your cursor on the Google Docs document where you want to place the table, right-click and select Paste.
You'll see a pop-up window with a couple of options.

- Select Link to Spreadsheet and select the Paste button.

This inserts the Google Sheets table into Google Docs exactly in the original format.

By linking the table, you can always update the table in Google Sheets and it will automatically update in Google Docs.

3. Embedding HTML in Google Docs using Word

If you have your simple HTML code saved in a .html or .htm file, you can open it in Microsoft Word first. Word always tries to render an HTML file. You can then import this document into Google Docs and copy the entire page or a section of the page into the document you're editing.

To do this, open Microsoft Word and its HTML file. You should see the file rendered the way it would look inside a browser.

Save this document in Word format.


Then, go back to Google Drive and upload the file to your Google Drive account.
Once uploaded, right-click and select Open with, then select Google Docs.

This will open the document in Google Docs format, which is as close to the HTML representation as possible.

Now you can copy the entire HTML file, or just the section you want. Then paste it into the Google Docs document you're editing.

Here are three ways to embed HTML into a Google document. The option you choose depends on the tools you have available. It also depends on whether you want the whole page or just a section and how much accuracy you need to match the original format rendered in HTML.

Can you web scrape in Google Sheets? You may also have the same question as Google sheets almost become one of the most popular cloud-based tool. Actually, Google sheets can be regarded as a basic web scraper. You can use a special formula to extract data from websites, import the data directly to google sheets and share it with your friends. By reading the following parts, you can learn the easy methods on how to build a simple web scraper with Google Sheets.

Table of Contents

  • Option#1: Build an easy web scraper using ImportXML in Google Spreadsheets
  • Option#2: Grab price data with a simple formula: ImportXML
  • Option#3: Another formula to get data with Google Sheets
  • Option#4: Automatic web scraping tool without coding

Option#1: Build an easy web scraper using ImportXML in Google Spreadsheets

Step 1: Open a new Google sheet.

Step 2: Open a target website with Chrome. In this case, we choose Games sales. Right-click on the web page and it brings out a drop-down menu. Then select "inspect". Press a combination of three keys: "Ctrl” + “Shift” + “C" to activate "Selector". This would allow the inspection panel to get the information of the selected element within the webpage.

Step 3: Copy and paste the website URL into the sheet.

Option#2: Grab price data with a simple formula: ImportXML

Step1: Copy the Xpath of the element. Select the price element, and Right-Click to bring out the drop-down menu. Then select “Copy”, choose “Copy XPath”.

Step 2: Type the formula to the spreadsheet.

=IMPORTXML(“URL”, “XPATH expression”) 

Note the "Xpath expression" is the one we just copied from Chrome. Replace the double quotation mark " " within the Xpath expression with a single quotation mark''.

Option#3: Another formula to get data with Google Sheets

There's another formula we can use:

=IMPORTHTML(“URL”, “QUERY”, Index)

With this formula, you extract the whole table.

Cara menggunakan import html google docs

Option#4: Automatic web scraping tool without coding

Now, let's see how the same scraping task can be accomplished easily with a web scraper, Octoparse. It allows you extract more data from website than Google Sheets, and you don't need to learn coding skills as it has auto-detect mode. Octoparse works on both Windows and Mac devices, download it and follow the steps below to enjoy.

A video about web scraping with Octoparse

Cara menggunakan import html google docs

Steps to Scrape Web Data with Google Sheets Web Scraping Alternative

Step 1: Open Octoparse after the quick installation, build a new task by choosing “+Task” under the “Advanced Mode”.

Step 2: Choose your preferred Task Group. Then enter the target website URL, and click "Save URL". In this case: Game Sale website http://steamspy.com/

Step 3: Notice Game Sale website is displayed within Octoparse interactive view section. We need to create a loop list to make Octoparse go through the listings.

1. Click one table row (it could be any file within the table) Octoparse then detects similar items and highlights them in red.

2. We need to extract by rows, so choose “TR” (Table Row) from the control panel.

3. After one row has been selected, choose the “Select all sub-element” command from the Action Tips panel. Choose “Select All” command to select all rows from the table.

Step 4: Choose “Extract data in the loop” to extract the data.

You can export the data to Excel, CSV, TXT or other desired formats. Whereas the spreadsheet needs you to physically copy and paste, Octoparse automates the process. In addition, Octoparse has more control over dynamic websites with AJAX or reCaptcha. 

If you're finding a data service for your project, Octoparse data service is a good choice. We work closely with you to understand your data requirement and make sure we deliver what you desire. Talk to Octoparse data expert now to discuss how web scraping services can help you maximize efforts.

Top 20 Web Crawling Tools for Extracting Web Data

Top 30 Big Data Tools for Data Analysis

Export Data to Google Sheets

Video: Create Your First Scraper with Octoparse 8.X