need help to FIX error in power query

%3CLINGO-SUB%20id%3D%22lingo-sub-3218026%22%20slang%3D%22en-US%22%3Eneed%20help%20to%20FIX%20error%20in%20power%20query%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3218026%22%20slang%3D%22en-US%22%3E%3CP%3Elet%3CBR%20%2F%3ESource%20%3D%20Json.Document(Web.Contents(%22%3CA%20href%3D%22https%3A%2F%2Fwww.nseindia.com%2Fapi%2Foption-chain-currency%3Fsymbol%3DUSDINR%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fwww.nseindia.com%2Fapi%2Foption-chain-currency%3Fsymbol%3DUSDINR%3C%2FA%3E%22%2C%20%5BHeaders%3D%5B%23%22Accept-Encoding%22%3D%22gzip%2C%20deflate%22%2C%20%23%22Accept-Language%22%3D%22en-US%2Cen%22%2C%20%23%22User-Agent%22%3D%22Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F81.0.4044.138%20Safari%2F537.36%20OPR%2F68.0.3618.206%22%2C%20Cookie%3DF859B23EBA840E6C5E14032853F73E31~Tm0eN80arDt6tRqd6t%2Bsz3VvzSHjfVoQVZ1EEc8GhkfS7%2B2BhErJQ7UEfSWhxqx%2BO8cCacQnOFWW1rT0oxO%2B1GygXWcPGN0dVId4Ku7OpSp1zzmnfeQI3v1BsZRQ5BMfdtQ8Z6Hfh3bqtysXMeiRN01LwJTf1ZrDzHzHI2DlU6E%3D%22%5D%5D))%2C%3CBR%20%2F%3Erecords%20%3D%20Source%5Brecords%5D%2C%3CBR%20%2F%3Edata%20%3D%20records%5Bdata%5D%2C%3CBR%20%2F%3E%23%22Converted%20to%20Table%22%20%3D%20Table.FromList(data%2C%20Splitter.SplitByNothing()%2C%20null%2C%20null%2C%20ExtraValues.Error)%2C%3CBR%20%2F%3E%23%22Expanded%20Column1%22%20%3D%20Table.ExpandRecordColumn(%23%22Converted%20to%20Table%22%2C%20%22Column1%22%2C%20%7B%22strikePrice%22%2C%20%22expiryDate%22%2C%20%22CE%22%2C%20%22PE%22%7D%2C%20%7B%22strikePrice%22%2C%20%22expiryDate%22%2C%20%22CE%22%2C%20%22PE%22%7D)%3CBR%20%2F%3Ein%3CBR%20%2F%3E%23%22Expanded%20Column1%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethere%20is%20a%20error%20%22TOKAN%20COMMA%20EXPECTED%22%3C%2FP%3E%3CP%3Edont%20know%20what%20to%20do%20with%20this%20code...please%20help%20me%20if%20possible%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3218026%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

let
Source = Json.Document(Web.Contents("https://www.nseindia.com/api/option-chain-currency?symbol=USDINR", [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=F859B23EBA840E6C5E14032853F73E31~Tm0eN80arDt6tRqd6t+sz3VvzSHjfVoQVZ1EEc8GhkfS7+2BhErJQ7UEfSWhxqx+O8cCacQnOFWW1rT0oxO+1GygXWcPGN0dVId4Ku7OpSp1zzmnfeQI3v1BsZRQ5BMfdtQ8Z6Hfh3bqtysXMeiRN01LwJTf1ZrDzHzHI2DlU6E="]])),
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"

 

 

there is a error "TOKAN COMMA EXPECTED"

dont know what to do with this code...please help me if possible

1 Reply

@arethiya Must have overlooked your post until now. Tried to connect to the site with your script and notice that the was a quotation mark missing in the Source step. Added on in the Coockie section like so:

Cookie="F859B23EBA8.......

 

Then the "token" error disappeared, but the site didn't accept the connection and timed-out. Perhaps you can fix that yourself.