marcob8986
New member
- Joined
- Dec 4, 2020
- Messages
- 7
- Reaction score
- 0
- Points
- 0
- Excel Version(s)
- 365
Hi there,
I'm finally writing here beacuse I've been struggling two full days on this and I haven't got the hang of it yet, so I hope to find some help here.
My desired outcome: being able to call a web API which needs authentication reading the key string from an Excel cell, letting the user to put in his own key.
I'v used this API several times for my own sake with my own personal key "hardcoded" in the source url, so everything is working.
This is the full URL:
After the "CMC_PRO_KEY=" goes the parameter I need to get from Excel itself.
My first attempt has been:
1. Name the range as "ApiKey"
2. Load this range in Power Query with this M-code:
3. Create a new blank query with this M-code:
Everythinh worked perfectly fine to me until I "distributed" the file to my team: everyone was getting formula.firewall errors or OLE.DB errors and so on.
I then realized I had PowerQuery set to ignore privacy levels and they didn't. Ignoring privacy levels in their pc is not a solution so I started to loook all over the web and I landed on Ken post here, but I can't seem to find a solution for my problem.
Can some of you guys help me out?
Attached the bare file with the connection which works if privacy is ignored and doesm't otherwise.
I'm finally writing here beacuse I've been struggling two full days on this and I haven't got the hang of it yet, so I hope to find some help here.
My desired outcome: being able to call a web API which needs authentication reading the key string from an Excel cell, letting the user to put in his own key.
I'v used this API several times for my own sake with my own personal key "hardcoded" in the source url, so everything is working.
This is the full URL:
https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?limit=400&convert=EUR&CMC_PRO_API_KEY=6d70b042-1df4-4e46-8877-e0db4ed4f25d |
After the "CMC_PRO_KEY=" goes the parameter I need to get from Excel itself.
My first attempt has been:
1. Name the range as "ApiKey"
2. Load this range in Power Query with this M-code:
Code:
let
Origine = Excel.CurrentWorkbook(){[Name="ApiKey"]}[Content],
Column1 = Origine{0}[Column1]
in
Column1
Code:
let
Origine = Json.Document(Web.Contents("https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?limit=400&convert=EUR&CMC_PRO_API_KEY=" & ApiKey)),
data = Origine[data],
#"Conversione in tabella" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Tabella Column1 espansa" = Table.ExpandRecordColumn(#"Conversione in tabella", "Column1", {"name", "symbol", "quote"}, {"name", "symbol", "quote"}),
#"Tabella quote espansa" = Table.ExpandRecordColumn(#"Tabella Column1 espansa", "quote", {"EUR"}, {"EUR"}),
#"Tabella EUR espansa" = Table.ExpandRecordColumn(#"Tabella quote espansa", "EUR", {"price"}, {"price"})
in
#"Tabella EUR espansa"
Everythinh worked perfectly fine to me until I "distributed" the file to my team: everyone was getting formula.firewall errors or OLE.DB errors and so on.
I then realized I had PowerQuery set to ignore privacy levels and they didn't. Ignoring privacy levels in their pc is not a solution so I started to loook all over the web and I landed on Ken post here, but I can't seem to find a solution for my problem.
Can some of you guys help me out?
Attached the bare file with the connection which works if privacy is ignored and doesm't otherwise.