Re: Marketo to Excel Power Query

jspain
Level 2

Marketo to Excel Power Query

Hello,

 

I am working to use the Power Query function to bring Marketo lead data into Excel. I have the following code written and have attached a screenshot of the error I am getting. Has anybody used Power query to bring in lead details from Marketo and what is causing this error? Any advice on this would be great. 

 

Screenshot 2024-03-05 at 12.50.17 PM.png

 

let
// Get url and credentials from config worksheet - Table REST_API_Authentication
mktoUrlStr = Excel.CurrentWorkbook(){[Name="REST_API_Authentication"]}[Content]{0}[URL],
clientIdStr = Excel.CurrentWorkbook(){[Name="REST_API_Authentication"]}[Content]{0}[Client ID],
clientSecretStr = Excel.CurrentWorkbook(){[Name="REST_API_Authentication"]}[Content]{0}[Client Secret],
// Calling Marketo API Get Access Token
getAccessTokenUrl = mktoUrlStr & "/identity/oauth/token?grant_type=client_credentials&client_id=" & clientIdStr & "&client_secret=" & clientSecretStr,
TokenJson = try Json.Document(Web.Contents(getAccessTokenUrl)) otherwise "Marketo REST API Authentication failed, please check your credentials",
// Parsing access token from Json
accessTokenStr = TokenJson[access_token]

in
accessTokenStr

 

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo to Excel Power Query

Can you please use the Syntax Highlighter ("Insert/Edit Code Sample") so your code is readable? Thanks.
jspain
Level 2

Re: Marketo to Excel Power Query

Hey Sanford, 

Thanks for the reply. I have updated the code with the Syntax highlighter. Let me know if that works 

Jo_Pitts1
Level 10 - Community Advisor

Re: Marketo to Excel Power Query

@jspain Can you show us the actual string that gets generated that you are using to make your call, and also the entire response body.