Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers!
Enter the sweepstakes now!Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.
Hi everyone,
I am trying to connect to the Google Search Console API using an R script in Power BI. I have successfully done this before with the Google Ads API and the Google Analytics 4 API, so I have the necessary Google permissions and authentication.
This time, I have added the permissions in the Google Search Console domain, but I am getting the following error, which I find strange because the code works perfectly in R. Does anyone know if I need any special permissions in Power BI?
Details
ADO.NET: Script R error. Fetching search analytics for url: https://wwwxxxxxxxxxx/ dates: 2023-01-01 2023-01-31 dimensions: country dimensionFilterExp: searchType: web aggregationType: auto 2024-02-14 13:33:54.523797 > Request Status Code: 403 Error in `abort_http()`: ! http_403 Request had insufficient authentication scopes. Backtrace: 1. searchConsoleR::search_analytics(...) 2. googleAuthR (local) search_analytics_g(...) 3. googleAuthR:::doHttrRequest(...) 4. googleAuthR:::retryRequest(...) 5. googleAuthR:::abort_http(status_code, error) 6. rlang::abort(...) Execution interrupted
Additional information:
Any help or suggestions would be greatly appreciated.
Thanks in advance,
Linda
P.S. I have also attached the R script for your reference.
R script:
library(searchConsoleR)
library(googleAuthR)
options(googleAuthR.scopes = c("https://www.googleapis.com/auth/webmasters"))
gar_auth_service("C:/Users/linda/OneDrive/Documentos/xxxxxx.json")
gsc <-
search_analytics(siteURL = "https://www.xxxxxxxx.xx/",
startDate = "2023-01-01",
endDate = "2023-01-31",
dimensions = "country",
searchType = "web",
rowLimit = 5000)
Hi @lindajzmin were you able to find a solution? As a workaround, maybe you can try to test your connection with a 3rd party connector. I currently use windsor.ai 's Search console connector and I haven't had any problem with my data. In case you wonder, to make the connection first search for the GSC connector in the data sources list:
After that, just grant access to your GSC account using your credentials, then on preview and destination page you will see a preview of your GSC fields:
There just select the fields you need. Finally, just select PBI as your data destination and finally just copy and paste the url on PBI --> Get Data --> Web --> Paste the url.
Thank you very much for your help, but first I will try with R because it is free, and then if it doesn't work, I will switch to windsor.ai... But your suggestion is very valuable.
Hi @lindajzmin
Please make sure that your connection is right, and maybe you can consider to use 'Web' connector and the api to conect to the google search console. there is a similar thread , you can refer to it.
Solved: Integrate Google Search Console API into Power BI - Microsoft Fabric Community
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the April 2025 Power BI update to learn about new features.
Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.