Calling a Local File from the External Tools Menu

External Tools Menu Gurus,

Is it possible to call a local PBIX file from the External Tools menu? I am working on building what I think is a cool tool for forum support based on @Melissa’s perpetual sample dataset, but I can’t get this aspect of it to work. I would have thought that you would just include the path to PBIdesktop.exe in the Path: section of the JSON file and the full path to the PBIX file in the Arguments: section, but it errors out when I initiate the call from the external tools menu.

JSON file attached. I’ve tried every conceivable permutation I can think of and still can’t get it to work.

Thanks in advance for your help.

  • Brian

@samaguire - looping you in specifically, given your prior Externals Tools menu success.

.perpetual practice dataset.pbitool.json (37.4 KB)

Quotes are missing around the filename, so PBID isn’t reading the full string. Change line 6 to this:

  "arguments": "\"C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Power BI Desktop\\External Tools\\Dataset.pbix\"",

FYI - Environment variables don’t get expanded either. You need to launch cmd/ps and then run a script if you need to do this.

@samaguire,

Bingo! Works perfectly now with the change to Line 6. Thanks so much for your help.

One more question - I didn’t understand this part of your response:

FYI - Environment variables don’t get expanded either. You need to launch cmd/ps and then run a script if you need to do this.

Can you please elaborate?

  • Brian

@BrianJ

When I’m talking about environment variables, I mean using variables like you would in a command prompt script to reference a folder location. i.e. in command prompt %CommonProgramFiles(x86)% = “C:\Program Files (x86)\Common Files”

1 Like

@samaguire,

I hope you don’t mind one more follow-on question. I made the modification you specified in post #2, and it worked perfectly for me. I asked members of the expert team to test it and got a strange outcome that I can’t replicate nor understand. We all unzipped the files to the proper external tools directory,:

C:\Program Files (x86)\Common Files\Microsoft Shared\Power BI Desktop\External Tools

and it worked fine for me and @Greg, but @Melissa continues to get the following error:

image

So, which result do you get when you unzip the files to the external tools directory, and do you have an explanation for and suggested fix for the problem Melissa is experiencing?

Thanks very much – really appreciate your help.

– Brian

Practice Dataset Tool.zip (1.2 MB)

Hey @BrianJ

Keeping it brief as it’s late. Checkout the attached. Practice Dataset.zip (1.1 MB)

Place zip contents in the usual external tools directory. Delete the 32bit json file if you are running the 64bit version of PBID, and vice versa if you have 32bit PBID. (You can keep both, but only one will work.)

NB: I reduced the size of the image, and updated the PBIX file to list options for the source XLSX

2 Likes

@samaguire,

Amazing! I can’t thank you enough for going so far above and beyond what I expected in your response. 100+ llne PowerShell script, plus all the other fixes. Based on watching some videos about creating external tools, I thought this would be easy but clearly I swam out way outside my depth.

I haven’t been able to try implementing this yet, since I’m in the process of running a very long ETL routine that I can’t interrupt, but will retest it on my machine and make sure I understand which files need to be in the final zip (since I think the zip you sent me includes both my original files and your revised files, and I think only the latter are relevant now, correct?)

Thanks again for all your help. Super impressed by what you’ve done here, and really appreciate it.

  • Brian

@BrianJ

No worries. Any reason to practice my PS scripting.

A little more info:

The problem is that Power BI can be installed to multiple locations. When installed via the MS Store it saves to “C:\Program Files\WindowsApps” - which requires elevated privileges to access.

The PS script is kicked off in elevated mode by a VBS script call - this is the JSON file application and argument. The PS script just checks the various locations, then runs PBID if the all the correct details are present.

I figured that if you can save the files to the external tools folder, you are an admin for the machine so it wouldn’t be a problem if the scripts run in elevated mode. (Which also means the Practice Dataset PBIX file can be saved while it is open.)

Also, the reason for the 2 JSON versions is the fact that the external tools folder is in a different location for a PBID install on a 32bit Windows version.

Ahhhhh… That solves the mystery of why Melissa was getting a different result than Greg and I in testing.

Thanks for the detailed explanation – learning a ton through this thread.

  • Brian
1 Like