The Easiest Way to Scrape Web Data with VBA

Поділитися
Вставка
  • Опубліковано 21 січ 2025

КОМЕНТАРІ • 170

  • @Excelmacromastery
    @Excelmacromastery  2 роки тому +24

    Learn how to write real-world Excel VBA code: 👉courses.excelmacromastery.com/
    Want to download the source code for this video? Go here: bit.ly/3NrfGt4

    • @viveksharma4193
      @viveksharma4193 2 роки тому

      how to fetch data from sql

    • @lesliebenjamin5487
      @lesliebenjamin5487 2 роки тому

      How can you handle say PAGINATED web data? same using VBA?

    • @sammybenmenahem
      @sammybenmenahem Рік тому

      But what if the page is not table elements, only divs and labels?

    • @vikrantchouhan9908
      @vikrantchouhan9908 10 місяців тому

      Hello sir, can one also load data on the html pages using the field ID (without relying on the sendkeys method). Any inputs will be valuable.

  • @bredmond812
    @bredmond812 2 роки тому +18

    No kidding. I've been watching videos on VBA web scraping since yesterday and was going through UA-cam literally right now looking for more getting ready for a project. Then you post this new video in the middle of that. Thank you!

    • @Excelmacromastery
      @Excelmacromastery  2 роки тому +1

      That's Great Brandon.

    • @bredmond812
      @bredmond812 2 роки тому

      @@Excelmacromastery Say, while I got your attention, do you know if it is feasable to capture a whole website and all its assets to make a copy of it?

  • @cristiano440
    @cristiano440 Рік тому +1

    The most useful thing I've seen this year... man... you rock!

  • @AlejandroSerranoJuan
    @AlejandroSerranoJuan 2 роки тому +3

    Really. You are the best VBA code professor I know. As you keep sharing we keep improving. Thanks for it.

  • @CAP0NE
    @CAP0NE Рік тому

    Very good video and annotations. In about only 7 minutes I've learned more then in an hour of searching and reading.
    Many thanks for that!

  • @redfeather22sa
    @redfeather22sa 2 роки тому +1

    Brilliant Paul !!! Thanks !! I've been using the same for years but glad there's an accessible reference to it on UA-cam now !!

  • @jenniferbabitzke9474
    @jenniferbabitzke9474 Рік тому

    This video and code is going to save me countless hours on a research project. Thank you so much!!!

  • @compscript7973
    @compscript7973 2 роки тому +2

    This was great.
    I have been watching videos all day and this is the first one that worked.
    I look forward to watching this same video using other methods besides tables.

  • @Code_Play_com
    @Code_Play_com 10 місяців тому

    Very practical and helpful video with very detailed explanation!

  • @serdip
    @serdip 2 роки тому +2

    Another AMAZING video! Thanks very much for showing how easy it can be to scrape data from web pages. The solution presented is simple and elegant and easily adapted to a wide variety of use cases. Thank you!!

  • @danielmelo389
    @danielmelo389 2 роки тому

    Best Excel channel on youtube

  • @free3690
    @free3690 2 роки тому +3

    Very helpful examples, thank you for the video!

  • @stevennevin7466
    @stevennevin7466 2 роки тому +1

    Excellent explanation. You have made this task much less daunting. 👏.

  • @postventatewis9968
    @postventatewis9968 2 роки тому +6

    Great, Paul. Thanks for this. I want to ask you two questions. How send user & password to a site, and how populate the search box with a input box or a cell content.Regards

    • @pedrohcp
      @pedrohcp 2 роки тому +1

      Wanna know as well

  • @alexandrumoldovan9936
    @alexandrumoldovan9936 2 роки тому +1

    Great video with lots of insights, which is really the norm for Paul at this point.
    Query tables look really powerful, maybe you could make a video more in detail about it in the future. I'm sure many, myself included, would find that very helpful.
    Thank you!

  • @DiogoMouraEstudos
    @DiogoMouraEstudos 2 роки тому

    Excellent tutorial, makes it possible to explore many fronts.

  • @dmp4096
    @dmp4096 2 роки тому

    THIS!!! IS!!! AWESOME!!! I was looking for a way to let a workbook pull down data from a MySQL database on the web easily. I think with the right bit of code on my server I can make this happen with these tools.
    THANK YOU SO MUCH!

    • @jvdb5509
      @jvdb5509 2 роки тому +1

      Have you tried using PowerQuery?

    • @dmp4096
      @dmp4096 2 роки тому

      @@jvdb5509 no. I really am no Excel wizard. I’m an old school programmer trying to automate some stuff for a good friend and our ski race league. I’ve developed a bit of familiarity with VBA and this idea seems to get me around some other areas I have no familiarity with… LOL ….as well as not requiring total control over the server…

    • @Excelmacromastery
      @Excelmacromastery  2 роки тому +1

      You're welcome

  • @johnwayne8059
    @johnwayne8059 2 роки тому +1

    Amazing video Paul!🥳🍀😁🤟😎

  • @orhanozturk1183
    @orhanozturk1183 2 роки тому +2

    Hi, if web site is protecting like How to add username and password entering code?

  • @MichaelWilliams-rf2jw
    @MichaelWilliams-rf2jw 2 роки тому

    I love this video! Thanks for sharing this info.

  • @deexcelguy
    @deexcelguy 2 роки тому

    Mind-blowing... Best Web scrapping with VBA video ❤❤❤

  • @MoraTara
    @MoraTara 8 місяців тому

    Hello, thank you for the video. I need help, please
    What should we do?
    If the site requires you to log in first, then scrape the data from it after that

  • @HahnsBurg
    @HahnsBurg Рік тому

    Thanks Paul. This video is very helpful. You should be canonized for your body of work.

  • @likhangsubok
    @likhangsubok 2 роки тому

    thank you so much for this tutorial, so helpful and very informative. watching from abu dhabi uae

  • @joaocustodio2094
    @joaocustodio2094 2 роки тому

    As always... well done Paul. Thanks very much.

  • @turkaykoc8587
    @turkaykoc8587 2 роки тому

    Thank you very much for sharing valuable information.

  • @youknowme6780
    @youknowme6780 Рік тому +1

    I am working on a vba to fill web form, it works on first IE page and submit the form, but when a new page loads with different web address, my code don't recognize the active web page... Any advice??? No selenium used

  • @HectorAgostoOne
    @HectorAgostoOne 2 роки тому

    Ahhh. This is excellent but I got so hooked to Power Automate for web scraping as it makes it sooo easy. Still, this tutorial is A+. Going to attempt this to have further hands on knowledge on vba

  • @hassanrozh6579
    @hassanrozh6579 2 роки тому

    Great job, thanks for sharing this helpful way.

  • @carlobugliarello5143
    @carlobugliarello5143 3 дні тому

    Very interesting video!! One question: if the website needs userid and password how I can modify the macro? Thank you.

  • @vbaclasses3553
    @vbaclasses3553 2 роки тому +1

    Great video, thanks for sharing. Another tool in the toolkit.

  • @gzfraud
    @gzfraud Рік тому

    QUESTION .... I scrape 10,00+ webpages so this will really help. BUT if a URL is embedded in text on a webpage, PQ or BI won't extract the URL eg email address is embedded in the person's name. I've searched and can't find it. Any ideas?

  • @CoolAmyKid
    @CoolAmyKid 2 роки тому

    how would I edit this code to just get one element from the webpage? preferably by ID
    thank you

  • @jennilong7798
    @jennilong7798 2 роки тому

    Is there a way to use the whole page code, but using a large list of URLs and placing their data into new sheets? 1 URL = 1 new sheet.
    I need to do this for a large amount of URLs and can't figure out how to do it in batches/more than one at a time.

  • @hjiraoussama776
    @hjiraoussama776 2 роки тому

    Is there a way to scrape data from multiple salary pdf payslips into excel table ?

  • @gecheung1155
    @gecheung1155 5 місяців тому

    Hello , love your code, but seem to run into a problem now then selenium couldn’t support chrome version 128, how can I resolve this, many thanks

  • @mmbcampus
    @mmbcampus 2 роки тому

    hello, How can i interact or populate a webpage form through VBA MSXML without opening IE or without IE method. pls kindly help?

  • @wayneedmondson1065
    @wayneedmondson1065 2 роки тому

    Great one! Thanks Paul.

  • @mannymtzgomez
    @mannymtzgomez Рік тому +1

    I can’t seem to get the code files, could you please post them again?

  • @softwareinfacont4438
    @softwareinfacont4438 Рік тому

    Hi. Excelent
    is it posible insert into MS ACCESS Table ?

  • @Ali_1
    @Ali_1 4 місяці тому

    Hello, I used the code with multiple pages and it successfully imported the data. But there is a secure page link for student data and the tables are secure. When I place the link, it does not import the data. Is there a solution for this?

  • @normalguystrive
    @normalguystrive 2 роки тому

    Anyone know if this can be used on a webpage with a username and password? IE, not public, but it's my account that I log into.

  • @meiyi6520
    @meiyi6520 2 роки тому

    Great video! How do I write the code if I need to scrap the table from mulitple web pages?

  • @Space.of.C
    @Space.of.C 2 роки тому

    If there are multiple tables on the website then how can I extract let say 1-5 tables ??

  • @alanlamb6047
    @alanlamb6047 2 роки тому +2

    Great video, well presented as always.
    As a long time excel user , I suspected this code was effectively the same as using the legacy data wizards
    (Data: GetData: Legacy Wizards: From Web. Note you may need to enable wizards: Excel Options: Data: Show legacy data import wizards: From Web)
    In some instances, I have found the legacy data connections are a lot faster than the modern PowerQuery methods
    Anyway, if you turn on the VBA recorder and then use the above wizard, you will get the same core VBA code generated as per the video
    However, in my quick performance check, the PQ method was substantially faster for this case

  • @derekharmon6999
    @derekharmon6999 2 роки тому

    Great video! Would I be able to pull out all terms on a webpage that were bolded and list them on a column with this same code?

  • @jacobnye4490
    @jacobnye4490 Рік тому

    Does this work for dynamic web pages?

  • @apbosh1
    @apbosh1 2 роки тому

    You're showing the chrome examples saying don't have to use all this code, I'm thinking that looks neat as, already. Superb information as usual. Do you have a video on reading larger csv files 250k rows but managing memory and cleaning up afterwards. I will look as well .

  • @s1ngularityxd64
    @s1ngularityxd64 2 роки тому

    This is so fast, amazing. How would you fetch urls from a table instead of a hard coded url?

  • @suqabi
    @suqabi Рік тому

    It give me error massage : unable to open "url". Cannot download the information requested.

  • @online7198
    @online7198 11 місяців тому

    Hello, I am Omar from Egypt. I am interested in your videos. I would like to ask a question. Can I access a data source for a website.
    When I search about some on website

  • @CollDott
    @CollDott 2 роки тому +1

    👍 Amazing!!

  • @raviprakashh
    @raviprakashh 2 роки тому

    Can you please suggest how to send data to web page and click on button.

  • @ELS737
    @ELS737 2 роки тому

    Tnak you for the Video, awesome! When I go to download stock quotes I only get updated data about once a minute, the sites seem to somehow prevent a second by second update. How would this still be possible?

  • @Irfan9191111
    @Irfan9191111 2 роки тому

    There is a QUERY function in google sheets. Any such option in Excel (including VBA)?

  • @Fabiprogamer4556
    @Fabiprogamer4556 Рік тому

    Hello, good evening, wow, excellent tutorial. I have tried the macros and they work wonderfully, but something strange happens to me and I have not been able to find what is happening.... I perform a scraping to a web whose unique table has more or less 15000 objects but it only reflects me in the sheet only 100 .... What could be happening? I hope you help me understand thank you very much...

  • @todddean7722
    @todddean7722 2 роки тому

    Can this method be used to navigate to other pages using links and to enter information needed, like login and passwords? If so, have you done a video on it? If so, may I get a link to the video? Thank you.

  • @golfmedic100
    @golfmedic100 2 роки тому

    great video - just wondering if this method be used to scrape a table ?

  • @Adam_K_W
    @Adam_K_W 2 роки тому

    Could this method be used to grab a JWT (*Jason Web Token) from an Azure Database for use in running a Single Sign On process?

  • @vivandh1404
    @vivandh1404 Рік тому

    sir how can we achieve IMPRTXML FUNCTIONALITY of google sheet into MS excel ?

  • @geoffj3191
    @geoffj3191 2 роки тому +1

    This is great, but how do you login and submit your username and password before you access the data. I can enter my username and password, but can't figure out how to click on the button as it doesn't seem to be clearly identifiable in the HTML.

  • @bxyhxyh
    @bxyhxyh 2 роки тому +1

    Hello, can you make a video to get unique values fastest way?
    - Dictionary way
    - Collection way
    - Unique function from 365 and 2021
    and other methods that i don't know etc...

  • @TheMisiekMisiek
    @TheMisiekMisiek 2 роки тому

    Perfect. Very useful.

  • @juniorortizaraujo6139
    @juniorortizaraujo6139 Рік тому

    Can we download excel report from a website ??

  • @fortak2006
    @fortak2006 2 роки тому

    this video is amazing, I used to use httprequest, how about if the website required login name and pw, is it possible use "query table"? thank you

  • @rafatshaikh3599
    @rafatshaikh3599 2 роки тому

    Hi, I want to scrap Indimart Data. There are no options for exporting the data. I want the leads available for the specific category. I have the API as well. Please can you guide me on this

  • @huonggiang537
    @huonggiang537 2 роки тому

    In case login requires captcha code, it is very difficult to pass this code, is there a way to scrape data from the website that is already logged in? Thank you very much

  • @rogerramos6745
    @rogerramos6745 2 роки тому

    I am trying to download the Query Table source code but I get stuck on an infinite loading screen. Is there a better way to get around this? As it stands right now the code generates an error saying "Incomplete Database"

  • @Jocedu06
    @Jocedu06 2 роки тому

    Awsome! This is the object used by powerquery when loaded in a table

  • @Donly1pt
    @Donly1pt 2 роки тому

    Excellent work. One question, is there a way to make the code wait for the query to complete before proceeding? Using that "Main" sub you used on the video as an example, if I have code after the UseQueryTable to do something with the values that I expect from the table it will try to do so before the table is there because the query takes a while. I tried using a Sleep function after the UseQueryTable call but it seems to also halt the progress of query....

    • @pjetrucha
      @pjetrucha 2 роки тому

      Had the same issue with macro which refreshed tables in Excel (connected to Oracle database through PowerQuery) and later used those tables in some calculations. I've tried Sleep, Wait but it didn't fit my needs. Finally I've stumbled upon DoEvents and it worked like a charm ;)

    • @Donly1pt
      @Donly1pt 2 роки тому

      @@pjetrucha how could I use doevents in this case to allow the query to complete?

  • @KhalilYasser
    @KhalilYasser 2 роки тому

    Awesome tutorial. Thanks a lot.

  • @vikrantchouhan9908
    @vikrantchouhan9908 2 роки тому +1

    Great one! Would it be possible to populate the data as well (on web pages) using this approach?

  • @Szajbus37
    @Szajbus37 2 роки тому

    Hi i just have a quastion about some help in my excel to automate a few steps, it's any chance to contant you ? Like discord or something else

  • @Mexico0607
    @Mexico0607 2 роки тому

    FIrst of all a very nice and useful tutorial. I have a practical question: I use the querytable approach. Unfortunately the webpage Table uses another number format then my Excel (. and , swapped for dezimals). Is it possible to change this in the querytable?

  • @charan888
    @charan888 2 роки тому +1

    What if there is an authentication to the website we are trying to access. How to handle that using query tables ?

    • @Excelmacromastery
      @Excelmacromastery  2 роки тому +1

      You would need to use one of the other libraries such as Selenium or Http XML.

  • @torbjornsvensson2527
    @torbjornsvensson2527 2 роки тому

    Nice Video! But I get the response that I have to Enable javascript from the webpage I try to scrape? Is there any solution for this?

  • @pbs36
    @pbs36 2 роки тому

    Great video.

  • @js-cx8wk
    @js-cx8wk 2 роки тому

    Thank you, nice video!!

  • @miless2111sutube
    @miless2111sutube 2 роки тому +1

    as always presented in a clear, easy and reassuring way :) How do you know which table reference (table 1) to use? Is it simply counting them visually or is there somewhere on the web page that you have to go to see that the table is referenced as table 1?

    • @Excelmacromastery
      @Excelmacromastery  2 роки тому +2

      No clear cut way. You can count them on the page but it's not always obvious what is a table. You can check the underlying html code. The easiest thing is to run the code until you hit the correct one although this may not always be feasible.

  • @micheltw
    @micheltw 2 роки тому

    Best web scraping video

  • @cacinaz8802
    @cacinaz8802 2 роки тому

    Incredible! Thank you. When I call up Yahoo! historical stock data, the date parameters are set to today's date and then back one year. Is there a way to set the date parameters differently?

    • @Excelmacromastery
      @Excelmacromastery  2 роки тому

      It may be possible if the parameters are in the url. otherwise you'll need to use either Chrome Selenium or XMLHttp.

  • @didierseverac
    @didierseverac 2 роки тому

    When you delete the table doesn't that breaks all the formulas that were using it ?

    • @Excelmacromastery
      @Excelmacromastery  2 роки тому

      Yes. If you want to simply update a table you can use Refresh once the table is created.

  • @klent3284
    @klent3284 2 роки тому

    The link for the source code doesn't seem to work. Getting this error: "This site can’t be reached"

  • @vincentblackwall8645
    @vincentblackwall8645 2 роки тому

    I have a question - how I can we scrape using your method, in case if I need scrape multiple tables from the different pages?

    • @Excelmacromastery
      @Excelmacromastery  2 роки тому

      You would use the AfterRefresh event to detect when the QueryTable Refresh was complete(see docs.microsoft.com/en-us/office/vba/api/excel.querytable.afterrefresh)

  • @jim2lane
    @jim2lane 2 роки тому +1

    For those who are fairly new to coding, what you see there in the VBA coding window is the development environment that all Microsoft centric coders worked in twenty years ago 😊

    • @FilipCordas
      @FilipCordas 2 роки тому

      Don't be ridiculous Visual Studio has been introduced in 2000 and it was by far the best ide in the world.

    • @jim2lane
      @jim2lane 2 роки тому +1

      @@FilipCordas actually, the first version of VS came out in '97. I used that version extensively back then, and each iteration since then. But the IDE experience back then was very similar to this - hence my comment

    • @stevenabel2068
      @stevenabel2068 Рік тому +1

      @@jim2lane I still have a copy of Visual Basic 1.0 - those were the days. Bleeding edge programming and boy were we bleeding at times

  • @garyburke9990
    @garyburke9990 2 роки тому

    Would be great if you could do a video on scraping an e-commerce site

  • @bigdatax6512
    @bigdatax6512 Рік тому

    is working for 100 pages??or just one page???

  • @cristhiancabra184
    @cristhiancabra184 2 роки тому

    Hello, excellent video, but i have a question, what if we need to get data from a webpage that isn't in a table and we need to find the html location? Can you make a video explaining that webscraping method please? how to extract specific data from a webpage

    • @mirekt1822
      @mirekt1822 2 роки тому

      Look at 5:42 there is some info but it needs some learning ;-)

  • @Victor-ol1lo
    @Victor-ol1lo 2 роки тому

    Awsome !! Thanks for sharing !!!

  • @davej429
    @davej429 2 роки тому

    Promising but after putting this in and running, it is just so very slow to pole the site and write the data. Not sure anything can be done to speed up. I'm using Windows 10 and Office 365.

  • @wojciechgebura3678
    @wojciechgebura3678 2 роки тому

    You're doing great job, Paul, thank you! One question: is it possible to scrape Web Data with VBA the exact way as follows?
    I define about hundred URLs and also three to five keywords/phrases to find on those websites. VBA does the search job and when found, it returns the results in a spreadsheet as links to the articles that content those keywords/phrases. The process would be repeated once a week. Is it doable with the VBA?

  • @KhanhNguyen-bn4jx
    @KhanhNguyen-bn4jx 2 роки тому

    thank you very helpful video.

  • @vv9730
    @vv9730 2 роки тому

    I'm new to VBA & thought the task look easy but still not find the way despite google.
    I want to achieve following through VBA code :
    i've following prepared:
    Column A- list of Urls
    Column B - download folder ( location on computer)
    Column C- status of downloaded file ,i.e. Ok,error,etc(required after completing following process)
    1.open the url from a list of urls ;
    2.find a specific button-"Excel" on the webpage opened in step 1;
    3.Click that button, a new window will pop up, asking the location to save the data in excel format;
    4.press save button to save the file;
    5.Open next url as per step 1 & repeat above process till all the files from specified urls are saved in specified folder.
    can u help on above..??

  • @wikanwiratmoko4446
    @wikanwiratmoko4446 Рік тому

    helo sir, how scrape data from registeried page ?

  • @salvatoreimperatore9553
    @salvatoreimperatore9553 Рік тому

    Hello, compliments, I would like to ask you if you think it is possible to create a vba for Google search. I would need to enter a barcode on the Excel sheet and through the search of the code it should return me product name, brand, description, and image link. Is something like this possible? It would be great if you could make a video for it. I think it would be interesting for all traders like me who have a physical store and an online site and each time uploading products to the site is boring because it involves thousands of product sheets, so if we could manage to search through the barcode product on the web and returns: product name, description, brand, and 3-4 product image links in an excel sheet to then upload the sheet to the site. Would be the best. Let me know if this idea of ​​mine is possible or impossible, thank you

  • @samektahadi
    @samektahadi 2 роки тому

    "needs to review the security of your connection before proceeding"
    hi, I got this message when running the vba code you're providing

  • @phanhuyhoang3720
    @phanhuyhoang3720 2 роки тому

    I’m stuck with f2a even I knew all credentials. Any Idea sir

  • @ap74249
    @ap74249 2 роки тому

    When I click the code
    link it just sits there forever not downloading anything

    • @Excelmacromastery
      @Excelmacromastery  2 роки тому

      Sounds like you have a popular blocker running. Turn it off and then try.

  • @GokhanAcikgoz-f1d
    @GokhanAcikgoz-f1d Рік тому

    Hello my teacher
    I watched your youtube videos and wanted to consult you on a difficult matter.
    We want to export the websites and e-mail addresses of the brands we find on the Internet into Excel. So on the left row is the company or brand name, right next to it is the website and email automatically retrieved from google.
    As we find new brands we will add them to the excel file and as the code runs it will continue to find their website and email.
    I would be very grateful if you could help me with this, free or paid.
    Enjoy your job.

  • @ignacioa3698
    @ignacioa3698 2 роки тому

    You able to do webscrape, however, scraping data from the page filters that I normally have to MANUALLY populate the search criteria? For example, I have to get just simple total numbers of times a particular person’s username processed certain items for the day.
    I have to do this for about 10 different users from my team at work. And I have to pull the data by manually populating that person’s username in the specific search filter field criteria then the page clocks and spits out the data table, then I manually highlight the data on the page in order to get a simple total number of times that come up for that specific username for the day. And I have to type and change the username on a specific filter search space every time for all of my work group members that I’m collecting the data.
    Also, depending on how long it takes the page to get the data, I know there’s a VBA feature that prevents the VBA from “timing out” in case the data at times takes longer depending on the size the data table.