• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

web connection after certain time gets expired &I have to copy cookie from website manually

arpit singh

New Member
my power query code is this:

>>> use code - tags <<<
let Source = Json.Document(Web.Contents(RequestURL(), [Headers=[#"Accept-Encoding"="gzip, deflate", #"Accept-Language"="en-US,en;q=0.5", #"User-Agent"="Mozilla/5.0 (Windows NT 6.1; rv:87.0) Gecko/20100101 Firefox/87.0", Cookie="nseappid=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcGkubnNlIiwiYXVkIjoiYXBpLm5zZSIsImlhdCI6MTYyMDAzMjc1NywiZXhwIjoxNjIwMDM2MzU3fQ.pcESi6UnqBF_I87BZh3vU6yDR1rxKbUc-OOLDiDppk4"]])), filtered = Source[filtered], data = filtered[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"}, {"Column1.strikePrice", "Column1.expiryDate", "Column1.CE", "Column1.PE"}), #"Renamed Columns" = Table.RenameColumns(#"Expanded Column1",{{"Column1.CE", "CALL"}, {"Column1.PE", "PUT"}}), #"Expanded CALL" = Table.ExpandRecordColumn(#"Renamed Columns", "CALL", {"strikePrice", "expiryDate", "underlying", "identifier", "openInterest", "changeinOpenInterest", "pchangeinOpenInterest", "totalTradedVolume", "impliedVolatility", "lastPrice", "change", "pChange", "totalBuyQuantity", "totalSellQuantity", "bidQty", "bidprice", "askQty", "askPrice", "underlyingValue"}, {"CALL.strikePrice", "CALL.expiryDate", "CALL.underlying", "CALL.identifier", "CALL.openInterest", "CALL.changeinOpenInterest", "CALL.pchangeinOpenInterest", "CALL.totalTradedVolume", "CALL.impliedVolatility", "CALL.lastPrice", "CALL.change", "CALL.pChange", "CALL.totalBuyQuantity", "CALL.totalSellQuantity", "CALL.bidQty", "CALL.bidprice", "CALL.askQty", "CALL.askPrice", "CALL.underlyingValue"}), #"Expanded PUT" = Table.ExpandRecordColumn(#"Expanded CALL", "PUT", {"strikePrice", "expiryDate", "underlying", "identifier", "openInterest", "changeinOpenInterest", "pchangeinOpenInterest", "totalTradedVolume", "impliedVolatility", "lastPrice", "change", "pChange", "totalBuyQuantity", "totalSellQuantity", "bidQty", "bidprice", "askQty", "askPrice", "underlyingValue"}, {"PUT.strikePrice", "PUT.expiryDate", "PUT.underlying", "PUT.identifier", "PUT.openInterest", "PUT.changeinOpenInterest", "PUT.pchangeinOpenInterest", "PUT.totalTradedVolume", "PUT.impliedVolatility", "PUT.lastPrice", "PUT.change", "PUT.pChange", "PUT.totalBuyQuantity", "PUT.totalSellQuantity", "PUT.bidQty", "PUT.bidprice", "PUT.askQty", "PUT.askPrice", "PUT.underlyingValue"}), #"Removed Columns" = Table.RemoveColumns(#"Expanded PUT",{"Column1.expiryDate"}) in #"Removed Columns"

This a national stock exchange website through which i have to refresh data after 1 min to get updated data & trade accordingly. But the issue is COOKIE gets expired after a certain time & I have to set it again & again. Is there any way to get Cookie header value from Nse website & then I can easily pass it as a value to this query to set cookie after a set time interval. Thanks in advance!!

Marc L

Excel Ninja
According to forum rules, you first forget - again ! - the code tags​
and as this is a - wild - cross posting you must post a link for every thread on the same subject created on any other forum​
and to the same on these forums …​