Welcome Guest ( Log In | Register )

5 Pages  1 2 3 > » Bottom

Outline · [ Standard ] · Linear+

 Stock Spreadsheet

views
     
TS97fangkhai97
post Mar 2 2020, 02:31 AM, updated 6y ago

Getting Started
**
Junior Member
64 posts

Joined: Apr 2011
Hi ! I am currently designing my own stock excel/google sheets but I can't seem to find a way to pull KLSE data into it. Is there any way for me to proceed?

Thanks
Yggdrasil
post Mar 2 2020, 09:07 AM

Look at all my stars!!
*******
Senior Member
2,210 posts

Joined: Jan 2018
QUOTE(97fangkhai97 @ Mar 2 2020, 02:31 AM)
Hi !  I am currently designing my own stock excel/google sheets but I can't seem to find a way to pull KLSE data into it. Is there any way for me to proceed?
*
I think it's not possible to obtain data on Google Sheets using Google Finance formula because it is not supported.
You might be able to if you have a paid database and use an add-on.

On Excel, it is possible to pull data from websites.
Example here.
So you may be able to pull from websites that has Malaysian closing price.

Example of pulling from klse.i3investor.com

user posted image
user posted image

Do note that most websites do not give live rates and are often delayed.
Therefore, it's not useful for daily trading.

Intimidated
post Mar 3 2020, 08:37 PM


***
Junior Member
499 posts

Joined: Dec 2007
QUOTE(Yggdrasil @ Mar 2 2020, 09:07 AM)
I think it's not possible to obtain data on Google Sheets using Google Finance formula because it is not supported.
You might be able to if you have a paid database and use an add-on.

On Excel, it is possible to pull data from websites.
Example here.
So you may be able to pull from websites that has Malaysian closing price.

Example of pulling from klse.i3investor.com

user posted image
user posted image

Do note that most websites do not give live rates and are often delayed.
Therefore, it's not useful for daily trading.
*
I just tried using =importxml in google sheet, it works! biggrin.gif

But I choose to scrape the price from Bloomberg instead, just a personal preference. Google limit the formula auto update in sheet at once per hour interval if use too many of the formula in one sheet, so not suitable for day trading too. Though it’s great to have the sheet as a tracker to check at night after work
Yggdrasil
post Mar 3 2020, 10:02 PM

Look at all my stars!!
*******
Senior Member
2,210 posts

Joined: Jan 2018
QUOTE(Intimidated @ Mar 3 2020, 08:37 PM)
I just tried using =importxml in google sheet, it works! biggrin.gif

But I choose to scrape the price from Bloomberg instead, just a personal preference. Google limit the formula auto update in sheet at once per hour interval if use too many of the formula in one sheet, so not suitable for day trading too. Though it’s great to have the sheet as a tracker to check at night after work
*
Thanks for sharing. But how do you get the Xpath?
I tried but I got an error.

user posted image

Took the Xpath from here. There's Xpath and full Xpath
user posted image
Intimidated
post Mar 3 2020, 10:15 PM


***
Junior Member
499 posts

Joined: Dec 2007
QUOTE(Yggdrasil @ Mar 3 2020, 10:02 PM)
Thanks for sharing. But how do you get the Xpath?
I tried but I got an error.

user posted image

Took the Xpath from here. There's Xpath and full Xpath
user posted image
*
I did this biggrin.gif

CODE


=importxml(D7,"//span[@class='priceText__1853e8a5']")


D7 = the cell that I put the Bloomberg url

Then I get a column of the url I want to track, and copy paste the =importxml formula

This post has been edited by Intimidated: Mar 3 2020, 10:17 PM
Yggdrasil
post Mar 3 2020, 10:21 PM

Look at all my stars!!
*******
Senior Member
2,210 posts

Joined: Jan 2018
QUOTE(Intimidated @ Mar 3 2020, 10:15 PM)
I did this biggrin.gif

CODE


=importxml(D7,"//span[@class='priceText__1853e8a5']")


D7 = the cell that I put the Bloomberg url

Then I get a column of the url I want to track, and copy paste the =importxml formula
*
Nice! But do you know how to get the code? So can use for other websites too brows.gif
Edit: Wait. I think the picture I posted has the answer lol.
Edit 2: Oops doesn't work. Ah well.

This post has been edited by Yggdrasil: Mar 3 2020, 10:28 PM
Intimidated
post Mar 3 2020, 10:26 PM


***
Junior Member
499 posts

Joined: Dec 2007
QUOTE(Yggdrasil @ Mar 3 2020, 10:21 PM)
Nice! But do you know how to get the code? So can use for other websites too  brows.gif
Edit: Wait. I think the picture I posted has the answer lol.
*
Ya ya i think the formula only works with things like
CODE

//td[@somethingsomething]
//a[@somethingsomething]
//span[@somethingsomething]

I also trial and error lol

This post has been edited by Intimidated: Mar 3 2020, 10:26 PM
Yggdrasil
post Mar 3 2020, 10:39 PM

Look at all my stars!!
*******
Senior Member
2,210 posts

Joined: Jan 2018
QUOTE(Intimidated @ Mar 3 2020, 10:26 PM)
Ya ya i think the formula only works with things like
CODE

//td[@somethingsomething]
//a[@somethingsomething]
//span[@somethingsomething]

I also trial and error lol
*
I think I found it. For example, klse.i3investor.com

user posted image

1. Input the formula like usual: =importxml("https://klse.i3investor.com/servlets/stk/annrep/6084.jsp",
2. Use inspect element to highlight the data.

As you can see, the code starts with "td". So,
CODE
//td[@


3. 0.38 which is the data we need is next to "class", so
CODE
//td[@class='


4. Fill in with the remaining code. So,
CODE
//td[@class='down big16']


5. Final code:

CODE
=importxml("https://klse.i3investor.com/servlets/stk/annrep/6084.jsp","//td[@class='down big16']")


6. Results

user posted image


Intimidated
post Mar 3 2020, 10:43 PM


***
Junior Member
499 posts

Joined: Dec 2007
QUOTE(Yggdrasil @ Mar 3 2020, 10:39 PM)
I think I found it. For example, klse.i3investor.com

user posted image

1. Input the formula like usual: =importxml("https://klse.i3investor.com/servlets/stk/annrep/6084.jsp",
2. Use inspect element to highlight the data.

As you can see, the code starts with "td". So,
CODE
//td[@


3. 0.38 which is the data we need is next to "class", so
CODE
//td[@class='


4. Fill in with the remaining code. So,
CODE
//td[@class='down big16']


5. Final code:

CODE
=importxml("https://klse.i3investor.com/servlets/stk/annrep/6084.jsp","//td[@class='down big16']")


6. Results

user posted image
*
Oh I just tried on a stock that gained instead of loss

The class will be ‘up big16’ instead

So maybe can do like

IFERROR(importxml_with_up big16, importxml_with_down big16)
Yggdrasil
post Mar 3 2020, 10:44 PM

Look at all my stars!!
*******
Senior Member
2,210 posts

Joined: Jan 2018
QUOTE(Intimidated @ Mar 3 2020, 10:43 PM)
Oh I just tried on a stock that gained instead of loss

The class will be ‘up big16’ instead

So maybe can do like

IFERROR(importxml_with_up big16, importxml_with_down big16)
*
Wow learnt something new today. Thanks for sharing!
bmwcaddy
post Mar 4 2020, 02:15 PM

On my way
****
Junior Member
513 posts

Joined: Dec 2006
Mine still have error of #NAME?

Any idea how to solve it ?
Yggdrasil
post Mar 4 2020, 02:18 PM

Look at all my stars!!
*******
Senior Member
2,210 posts

Joined: Jan 2018
QUOTE(bmwcaddy @ Mar 4 2020, 02:15 PM)
Mine still have error of #NAME?

Any idea how to solve it ?
*
Which website and which stock?
Post your formula here
bmwcaddy
post Mar 4 2020, 02:23 PM

On my way
****
Junior Member
513 posts

Joined: Dec 2006
QUOTE(Yggdrasil @ Mar 4 2020, 02:18 PM)
Which website and which stock?
Post your formula here
*
SUNREIT, from KLSE i3investor

=importxml("https://klse.i3investor.com/servlets/stk/5176.jsp","//tdclass='up big16'")
Yggdrasil
post Mar 4 2020, 02:35 PM

Look at all my stars!!
*******
Senior Member
2,210 posts

Joined: Jan 2018
QUOTE(bmwcaddy @ Mar 4 2020, 02:23 PM)
SUNREIT, from KLSE i3investor

=importxml("https://klse.i3investor.com/servlets/stk/5176.jsp","//tdclass='up big16'")
*
Hmm. klse.i3investor.com code is unstable as it changes everytime.

Use Bloomberg instead. E.g. for Sunreit:

CODE
=importxml("https://www.bloomberg.com/quote/SREIT:MK","//span[@class='priceText__1853e8a5']")

hft
post Mar 4 2020, 02:38 PM

Regular
******
Senior Member
1,081 posts

Joined: Aug 2018
QUOTE(97fangkhai97 @ Mar 2 2020, 02:31 AM)
Hi !  I am currently designing my own stock excel/google sheets but I can't seem to find a way to pull KLSE data into it. Is there any way for me to proceed?

Thanks
*
Why need to use excel? Plenty of established free or by subscription tool available. You want to be successful or just having fancy excel sheet is the goal?
bmwcaddy
post Mar 4 2020, 02:46 PM

On my way
****
Junior Member
513 posts

Joined: Dec 2006
QUOTE(Yggdrasil @ Mar 4 2020, 02:35 PM)
Hmm. klse.i3investor.com code is unstable as it changes everytime.

Use Bloomberg instead. E.g. for Sunreit:

CODE
=importxml("https://www.bloomberg.com/quote/SREIT:MK","//span[@class='priceText__1853e8a5']")

*
Still the same problem wor. Am i missing out anything? need to enable any developer tools etc. ? I just copied your code into my excel formula then #NAME?
Yggdrasil
post Mar 4 2020, 02:50 PM

Look at all my stars!!
*******
Senior Member
2,210 posts

Joined: Jan 2018
QUOTE(bmwcaddy @ Mar 4 2020, 02:46 PM)
Still the same problem wor. Am i missing out anything? need to enable any developer tools etc. ? I just copied your code into my excel formula then #NAME?
*
The code is for Sheets. For Excel, you need to import the data from the link.
bmwcaddy
post Mar 4 2020, 02:58 PM

On my way
****
Junior Member
513 posts

Joined: Dec 2006
QUOTE(Yggdrasil @ Mar 4 2020, 02:50 PM)
The code is for Sheets. For Excel, you need to import the data from the link.
*
Ah my bad for not reading it. Got it (on sheets).

Thanks!
Yggdrasil
post Mar 4 2020, 03:04 PM

Look at all my stars!!
*******
Senior Member
2,210 posts

Joined: Jan 2018
QUOTE(bmwcaddy @ Mar 4 2020, 02:46 PM)
Still the same problem wor. Am i missing out anything? need to enable any developer tools etc. ? I just copied your code into my excel formula then #NAME?
*
bmwcaddy

Rough guide how to get the data. Clean up later if you want.

Excel
1. Copy URL.
user posted image

2. In Excel, go to Data.
user posted image

3. Paste link.

user posted image

4. Navigate to the info you want. Easy way is to just import the whole table and hide the sheet we don't want. Click load.

user posted image

5. It will appear like this.

user posted image

6. Clean up if you want. My putting a master sheet with what you want to see and the other data in another sheet like this.

user posted image

7. Click refresh all when you want to get latest data.

user posted image




bmwcaddy
post Mar 4 2020, 03:13 PM

On my way
****
Junior Member
513 posts

Joined: Dec 2006
QUOTE(Yggdrasil @ Mar 4 2020, 03:04 PM)
bmwcaddy

Rough guide how to get the data. Clean up later if you want.

Excel
1. Copy URL.
user posted image

2. In Excel, go to Data.
user posted image

3. Paste link.

user posted image

4. Navigate to the info you want. Easy way is to just import the whole table and hide the sheet we don't want. Click load.

user posted image

5. It will appear like this.

user posted image

6. Clean up if you want. My putting a master sheet with what you want to see and the other data in another sheet like this.

user posted image

7. Click refresh all when you want to get latest data.

user posted image
*
Thanks for the detailed steps. But my problem seems to be stuck at step 2: My excel 2016 cant run the script (error running) of the website, causing it to crash whenever i past any web link

5 Pages  1 2 3 > » Top
 

Change to:
| Lo-Fi Version
0.0245sec    0.98    6 queries    GZIP Disabled
Time is now: 21st December 2025 - 11:36 AM