• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

Need ImportHTML function like Google Sheets|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / Need ImportHTML function like Google Sheets|General Excel Questions & Answers|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumGeneral Excel Questions & Answe…Need ImportHTML function like Googl…
sp_PrintTopic sp_TopicIcon
Need ImportHTML function like Google Sheets
Avatar
Kevin Meier
Member
Members
Level 0
Forum Posts: 6
Member Since:
January 23, 2021
sp_UserOfflineSmall Offline
1
January 23, 2021 - 7:28 pm
sp_Permalink sp_Print sp_EditHistory

I am looking at building a Stock Portfolio using Excel

The problem is that Excel doesn't have the function ImportHTML and everything that I have tried is not working.  I want to avoid using Power BI so wondering if anyone has any ideas on how I can achieve my goal using Power Query or a custom function.

Keep in mind that I don't want to download any more data than is needed and Google Sheets ImportHTML meets that requirement.

 

Thanks,

Kevin

Avatar
Anders Sehlstedt
Eskilstuna, Sweden

VIP
Members


Trusted Members
Level 3
Forum Posts: 880
Member Since:
December 7, 2016
sp_UserOfflineSmall Offline
2
January 24, 2021 - 6:20 am
sp_Permalink sp_Print

Hello,

I am no Google Sheets user so I don’t know how ImportHTML function works, but when reading about it I think it is similar to get data from web using Power Query. Have you tried it?

Br,
Anders

Avatar
Kevin Meier
Member
Members
Level 0
Forum Posts: 6
Member Since:
January 23, 2021
sp_UserOfflineSmall Offline
3
January 24, 2021 - 2:05 pm
sp_Permalink sp_Print sp_EditHistory

Hi Anders, thanks for the reply.  Unfortunately, my Youtube video was removed from my post, but what I can tell you is that ImportHTML allows me to specify the table to pull data.  I then use the Index function to get the specific data I want.  This is extremely useful when pulling data from sites such as Finviz where the summary page contains many tables.  I have not figure out a way to do this with "get data from web" as it seems to want a web page that contains a single table.  For example, one of the common ways I use this is as follows:

=Index(ImportHMTL("http://finviz.com/quote.ashx?t="&B2,"table", 8), 11, 6)

This call will get the data for a specific ticker symbol from table number 8 and then the index function will return the Earnings data from row 11 col 6.

=Index(ImportHMTL("http://finviz.com/quote.ashx?t="&B2,"table", 8), 1, 4) - returns the PE ratio

 

If there is a way to do this using the method you described, can you possibly provide an example?

 

Thanks,

Kevin

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4619
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
4
January 24, 2021 - 3:57 pm
sp_Permalink sp_Print

Hi Kevin,

When you provide Power Query with a URL to get data from, it will present you a list of the tables on that page from which you can choose the one you want. Without an example link from you I can't give you an example in return, but you can try it yourself by following the link to the tutorial Anders provided you above.

Mynda

Avatar
Kevin Meier
Member
Members
Level 0
Forum Posts: 6
Member Since:
January 23, 2021
sp_UserOfflineSmall Offline
5
January 24, 2021 - 8:53 pm
sp_Permalink sp_Print sp_EditHistory

Hi Mynda,

 

The example links are in my previous post.  The &B2 portion is just a parameter which is a stock ticker such as AAPL.  I will play around with Power Query, but I'm not very proficient in it.

On another note, I did discover the Stock feature under the Data tab which works fairly well, but it does not return all of the attributes I need.

 

Cheers!

Kevin

Avatar
Anders Sehlstedt
Eskilstuna, Sweden

VIP
Members


Trusted Members
Level 3
Forum Posts: 880
Member Since:
December 7, 2016
sp_UserOfflineSmall Offline
6
January 24, 2021 - 8:55 pm
sp_Permalink sp_Print

Hi Kevin,

A bit off topic perhaps, but seeing you want financial data, have you checked out what Excel Data Types or STOCKHISTORY function can do?
You need of course to have Excel 365 in order to use these.

You can read more about the stocs financial data type here.
And more about STOCKHISTORY function here.

Br,
Anders

Avatar
Kevin Meier
Member
Members
Level 0
Forum Posts: 6
Member Since:
January 23, 2021
sp_UserOfflineSmall Offline
7
January 25, 2021 - 8:54 am
sp_Permalink sp_Print sp_EditHistory

Thanks Anders,

I did look at the stock history function, but unfortunately, it only returns the close, unlike Google Sheets ImportHTML() where I can't go after any specific attribute from a table.  I also played around the Power Query suggested by both you and Mynda, but it is not really what I am looking for because I need to return specific attributes in the table of stocks.  So given the following example:

          A           B            C                D                 E             F             G

1    Symbol   Price   Change %  Change $    Gain %     Gain $   Dividend

2    VXC        $46.63     0.39%           $0.90        12.26%     $25.47       $0.17

3    AQN       $21.98     0.55%          $12.00         0.32%       $7.05       $0.00

 

I currently acquire the values for row 2 in Google Sheets using either ImportHTML() (For Finviz or other sources) or GoogleFinance() as follows:

Price          =GoogleFinance(A2, "Price")

Change %  =GoogleFinance(A2, "Changepct")

Change $   =GoogleFinance(A2, "Change")

Dividend    =Index(ImportHTML("http://finviz.com/quote.ashx?t="&A2,"table",8),7,2)

etc.

 

In Excel I can get most of the way to my goal using the "Stocks" Data Type in the Queries & Connections pane, which is actually perfect for my needs.  Unfortunately, the Stocks data type is limited in the number of attributes it can return.  It will not return attributes such as ATR, RSI, EPS, Dividend and many more.  I can also use Power Query to download data from Finviz for a particular stock, but that is not dynamic which is needed because I am constantly adding new stocks to my portfolio.  I even figured out how to parameterize the Power Query, but again I'm not sure how to achieve my requirement on the row by row basis from my portfolio since each row is a download of data from Finviz for a specific stock ticker.  I suspect I will just have to live with what is available in the Stocks data type for now and hope Microsoft adds more attributes over time.

I have a great Stock Tracker built using Google Sheets, but I don't like the idea of Big Brother having access to my data.  This is the only reason I am looking to rebuild using Excel.

 

Cheers!

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4619
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
8
January 25, 2021 - 11:21 am
sp_Permalink sp_Print

Hi Kevin,

If you prefer, you can use STOCKHISTORY to get the close and you can calculate the change and change % by getting the close from the previous day also using STOCKHISTORY. Or you can just use the Stocks data type for these attributes (and the dividend), as you've already found.

You say "... I'm not sure how to achieve my requirement on the row by row basis from my portfolio since each row is a download of data from Finviz for a specific stock ticker. "

I don't know what you mean by this and it's difficult to help without an example of your desired end result and URL for the source data.

Mynda

Avatar
Kevin Meier
Member
Members
Level 0
Forum Posts: 6
Member Since:
January 23, 2021
sp_UserOfflineSmall Offline
9
January 25, 2021 - 2:34 pm
sp_Permalink sp_Print

Hi Mynda,

Sorry, I don't think I am doing a good job of explaining myself.  Those fields I listed were just examples.... there are over a dozen attributes that I cannot get using Excel unless I use Power Query.  Power Query just isn't a good solution for a dynamic list of stocks when I need real-time data for each row every time I open the workbook.

I'm sure an Excel guru like you could figure out a solution, but it is just beyond my capabilities given my current knowledge in Excel.  I have decided to just stick with Google Sheets for this solution until Excel matures a bit more in this area.  I would love to send you a Youtube link for a really nice Google Sheet Portfolio Manager, but the link was removed from my original post.

 

Cheers!

Kevin

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4619
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
10
January 25, 2021 - 4:24 pm
sp_Permalink sp_Print

Ok, no worries. FYI, you can set Power Query to refresh upon opening of your file if that helps.

BTW, we didn't remove your link. I'd say it didn't save properly for some reason when you posted your question originally.

Mynda

Avatar
Kevin Meier
Member
Members
Level 0
Forum Posts: 6
Member Since:
January 23, 2021
sp_UserOfflineSmall Offline
11
January 25, 2021 - 6:00 pm
sp_Permalink sp_Print

Here is an example that I started with.  I thought I would send it to you in case you are looking for another video idea.  I'm sure anything you came up with would be better than this.

 

 

Cheers!

Avatar
Mynda Treacy
Admin
Level 10
Forum Posts: 4619
Member Since:
July 16, 2010
sp_UserOfflineSmall Offline
12
January 25, 2021 - 6:22 pm
sp_Permalink sp_Print

Hi Kevin,

Coincidentally, I have a video on creating your own personal portfolio dashboard coming out next week!

Mynda

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Steven Grigsby, Ayal Telem, Daisy Tang
Guest(s) 8
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
Hans Hallebeek: 185
Newest Members:
Kwaje Alfred Mogga
thong nguyen
Appiagyei Kofi Frimpong
Hilary Burchfield
Richie Wright
Adel Kock
Barbara Murray
Doug Milne
Siobhan Stringer
Rob Rooth
Forum Stats:
Groups: 3
Forums: 24
Topics: 6544
Posts: 28650

 

Member Stats:
Guest Posters: 49
Members: 32831
Moderators: 2
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate
  • Sponsor Our Newsletter

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.