Web Scraping Made Easy With Google Sheets
HTML-код
- Опубликовано: 20 июн 2024
- Learn how to perform basic web scraping using Google Sheets. Since this technique is not scalable, for anything advanced, you’d have to rely on professional solutions, such as the ones offered by Oxylabs 👉 oxy.yt/Qig3
Web scraping with Google Sheets can be an effective technique. While most ways of web scraping require you to write code, web scraping with Google Sheets requires no coding or add-ons. All you need to do is use a built-in function of Google Sheets. Thus, it acts as a basic web scraper.
Follow this detailed video tutorial to learn how you can extract website data directly to Google Sheets, dive deeper into several related functions, hear about the most common errors you might encounter, and much more.
Sources used in the tutorial:
👉 books.toscrape.com/
👉 en.wikipedia.org/wiki/List_of...
👉 rss.nytimes.com/services/xml/...
👉 www2.census.gov/programs-surv...
For you convenience, we also have this step-by-step guide covered in a blog post as well as GitHub:
👉 oxy.yt/vihQ
👉 oxy.yt/NijF
Watch other web scraping tutorials:
Web Scraping With Beautiful Soup (Step-by-Step Tutorial)
🎥 oxy.yt/QikO
How to Extract Public Data at Scale; Easy to Follow Tutorial
🎥 oxy.yt/Xilu
How to Scrape Multiple Website URLs With Python
🎥 oxy.yt/Xizt
✅ Grow Your Business with Top-Tier Web Data Collection Infrastructure: oxy.yt/rixG
Join over a thousand businesses that use Oxylabs' scraping solutions:
Web Scraper API:
👉 oxy.yt/oicE
E-Commerce Scraper API:
👉 oxy.yt/livR
SERP Scraper API:
👉 oxy.yt/0ibR
In this video, Liza covers the following:
00:00 Introduction
00:26 Why use Google Sheets for web scraping?
00:46 When should you think of using it?
01:11 Importing XML and HTML
02:38 IMPORTXML and XPath intro
03:51 Extracting data from a website to Google Sheets
05:06 Related functions
05:42 Importing a table from a website to Google Sheets
06:27 Importing data from XML feeds to Google Sheets
07:09 Customizing data imported by IMPORTFEED
07:49 Importing data from CSV to Google Sheets
08:12 Does the data stay fresh?
08:32 Advantages and drawbacks of import functions
09:12 Common errors
10:03 Conclusion
© 2022 Oxylabs. All rights reserved. Наука
Thanks for watching! We hope you enjoyed this video 💙 Find more content like this here: oxy.yt/jimW
Thanks alot❤️ for such informative video
Fantastic information, great video, thank you 💯😃👍
We're glad it helped!
I have a problem using the importxml function when web scraping the yahoo finance page. Is this because of the page's restrictions?
Great!
Happy you liked it!
Awesome video, very helpful.
Could you please tell how to get data from pages opened on different tabs and store data to a same sheet.
Python Script to Scrape Data from Multiple Tabs:
from selenium import webdriver
from bs4 import BeautifulSoup
import pandas as pd
import time
def scrape_data_from_page(driver):
# Your scraping logic here
soup = BeautifulSoup(driver.page_source, 'html.parser')
data = soup.find_all('your_element_selector')
return extracted_data
def open_tab_and_load_url(driver, url):
driver.execute_script("window.open('', '_blank');")
driver.switch_to.window(driver.window_handles[-1])
driver.get(url)
def close_current_tab(driver):
driver.close()
driver.switch_to.window(driver.window_handles[-1])
def scrape_data_from_tabs(urls):
driver = webdriver.Chrome()
combined_data = pd.DataFrame()
try:
for url in urls:
open_tab_and_load_url(driver, url)
time.sleep(2)
data = scrape_data_from_page(driver)
combined_data = combined_data.append(data, ignore_index=True)
close_current_tab(driver)
finally:
driver.quit()
return combined_data
url_list = ['url1', 'url2', 'url3']
result_data = scrape_data_from_tabs(url_list)
result_data.to_csv('combined_data.csv', index=False)
Replace 'your_element_selector', 'url1', 'url2', etc. with your values. Adjust time.sleep(2) based on page load times.
@@oxylabs wow, thanks. I'm not good in coding, but will try with chatgpt to run this code, meanwhile if you know any no code idea let me know.
Actually I got a bookmarklet code from Bing, it opens links in ne tabs and scraps details and copy to clipboard. But we have to click for each page manually, if I ask for automation the code it gives don't work. I'm in search of somehow automating it. I have an application called quick macro. To try with that today. Will let you know. Do you wanna see the code for opening new tabs and copying details to clipboard?
Fantastic
Happy you've enjoyed it!
Hello, I sell on Amazon and I would like to retrieve my sales history in a Google sheet, do you think I could use this method?
In theory, yes.
@oxylabs ok great and can you show me how I could do it
Damn is the woman talking real she looks ai generated
Liza is indeed a very real colleague of ours 💙
@@oxylabs she's beautiful and smart tell her i'll marry her soon