Cannot call python to download youtube videos from apple script launched by AppleScriptTask in vba Excel 365 for Mac

enninet

New Member
Joined
Dec 26, 2020
Messages
1
Office Version
  1. 365
Platform
  1. MacOS
I want to download a list of youtube videos and save with corresponding file names. All those data are stored in Excel 365 for Mac. The python has YouTube package to do it. So the natural idea is to write some vba, to execute a terminal command to run the python file like "python3 YTdownloader.py". Everything works fine when I directly run this command in terminal windows.

I know there is a so-called sandboxing restriction in VBA Excel 365 for mac, which prevents from directly execute terminal command in VBA using previously available MacScript. But according to MS document, we should be able to use AppleScriptTask to run Apple script functions with parameters. I leant and wrote an apple script file, put it into a right place required by the vba. It works perfectly when I run the apple script in script editor or Visual Studio Code (after installing the apple script interpreter), and downloaded youtube videos.

It does work to passing parameters to apple script via a string. But when I try to run a terminal command to run the python YTdownloader.py, there is run time error 5 in vba, saying wrong procedure call or arguments. (but it does work with exactly same parameter either in script editor or VS code, or in terminal). I thought I may have to grand Excel with access to all folders involved. So I did so by running GrantAccessToMultipleFiles. But unfortunately it still not work.

I would appreciate if someone can tell me any idea to overcome this.
Thanks
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top