ThePromptIndex / ExcelAI

ExcelAI Assistant ExcelAI Assistant is a VBA-based tool that integrates with the OpenAI GPT-4 API to provide intelligent responses directly within the Excel environment.
3 stars 0 forks source link

Making http calls on Mac OSX #1

Open jtibrewala opened 3 weeks ago

jtibrewala commented 3 weeks ago

What is the equivalent of CreateObject("MSXML2.XMLHTTP") to call an http request from vba in excel on MacOSX? This code only works on Windows and is not Mac compatible.

ThePromptIndex commented 3 weeks ago

You can make HTTP requests from VBA in Excel on macOS using AppleScript.

Create an AppleScript to make the HTTP request: Save the following AppleScript as HTTPRequest.scpt using the Script Editor.

on run {url} set curlCommand to "curl -s " & url set response to do shell script curlCommand return response end run

Then Call the AppleScript from VBA: Use the MacScript function to call this AppleScript from your VBA code