Ganesan Ramanathan
New Member
- Joined
- Dec 14, 2023
- Messages
- 1
- Office Version
- 2013
- Platform
- Windows
I am new to power query
I am able to query the following website and get things in a table form using power query.
let cookies=()=>
(cookie entered as site request cookie)
in
cookies
stored as Table 1connection only.
Function query
let
Source = Json.Document(Web.Contents("https://www.nseindia.com/api/option-chain-indices?symbol=NIFTY", [Headers=[#"Accept-Encoding"="gzip, deflate", #"Accept-Language"="en-US,en", #"User-Agent"="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 OPR/68.0.3618.206", Cookie="8A87B46ABA4CAFF3B69F913708597828~xM8YKIspOw4k2OTekhqVI8Ft8AHi/RYKbvLqfKirkbafd1XOqJELenPBKr4Y+FAgbqei34v6NKmWyp1RWvhDhh2jrLXAela7ZdmyrHShEPCaVopVDul8R91B2SbFshwrUsS7yKn5+cmpmaF25zGeiAjHTfTMnii7F2E1slCnkEo="]])),
records = Source[records],
data = records[data],
#"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"strikePrice", "expiryDate", "CE", "PE"}, {"strikePrice", "expiryDate", "CE", "PE"})
in
#"Expanded Column1"
returns tabular form in Sheet 2.
I want to access particular table elements.
My subroutine
Sub ganout()
Dim ws As Worksheet
ws = Sheet2
out1 = ws !records[0].data[0].CE.strikeprice
End Sub
in sheet 3 returns compiler error require end of statement.
How to go about it? Kindly advise.
I am able to query the following website and get things in a table form using power query.
let cookies=()=>
(cookie entered as site request cookie)
in
cookies
stored as Table 1connection only.
Function query
let
Source = Json.Document(Web.Contents("https://www.nseindia.com/api/option-chain-indices?symbol=NIFTY", [Headers=[#"Accept-Encoding"="gzip, deflate", #"Accept-Language"="en-US,en", #"User-Agent"="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 OPR/68.0.3618.206", Cookie="8A87B46ABA4CAFF3B69F913708597828~xM8YKIspOw4k2OTekhqVI8Ft8AHi/RYKbvLqfKirkbafd1XOqJELenPBKr4Y+FAgbqei34v6NKmWyp1RWvhDhh2jrLXAela7ZdmyrHShEPCaVopVDul8R91B2SbFshwrUsS7yKn5+cmpmaF25zGeiAjHTfTMnii7F2E1slCnkEo="]])),
records = Source[records],
data = records[data],
#"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"strikePrice", "expiryDate", "CE", "PE"}, {"strikePrice", "expiryDate", "CE", "PE"})
in
#"Expanded Column1"
returns tabular form in Sheet 2.
I want to access particular table elements.
My subroutine
Sub ganout()
Dim ws As Worksheet
ws = Sheet2
out1 = ws !records[0].data[0].CE.strikeprice
End Sub
in sheet 3 returns compiler error require end of statement.
How to go about it? Kindly advise.