This repository contains the VBA scripts required to build a Modzy integration with Excel on a Windows machine.
This repository contains resources for building a Modzy integration into Excel with VBA
- Clone repository:
git clone https://github.com/modzy/excel-integration-windows.git
- Open the
./data/modzy-credit-default-risk-data.xlsx
Excel workbook - Add a sheet and name it "ML Predictions"
- Enable your Developer Tab: Open up Excel --> go to Preferences --> go to Ribbon & Toolbar --> click on the "Developer" tab to enable it in the main ribbon
- Open up the VBA IDE: Click on the "Developer" tab -> Click on the "Visual Basic" icon
- Add Modzy API Class: Right click your VBA project, select "Import File," and add the
scripts/API_Client.cls
class module - Add modules: Right click your VBA project, select "Import File," and add both
scripts/JsonConverter.bas
andscripts/RunModzyModel.bas
modules. - Open "Module1" under the "Modules" folder, and navigate to the
runHomeCreditModel()
method at the bottom of the script. Here replace "" and "" with your valid Modzy credentials. - Turn "Microsoft Scripting Runtime" on: Go to Tools --> References --> Scroll down to "Microsoft Scripting Runtime" and check the box --> OK
- Save workbook as Macro-Enabled Workbook
- In the "ML Predictions" sheet within your workbook, add a form control button: Developer Tab --> Insert --> Button (Form Controls), and select
runHomeCreditModel
as the macro enabled by this button. - Replace the text in the button with whatever phrase you prefer (e.g., "Run Model").
- In Cell A6, type "Row Label", and in Cell B6, type "Risk Score"
- Press your button to kick off an inference job in Modzy.
This integration takes the data from the "Preprocessed Data" sheet, formats it into the required CSV format, submits it to a model within Modzy, and returns the predictions directly to the "ML Predictions" sheet, ultimately demonstrating how to integrate AI capabilities into a tool business analysts use daily.
- Data: contains spreadsheet with raw and preprocessed sample data for this integration
- Scripts: contains API class and modules required to build this integration
We are happy to receive contributions from all of our users. Check out our contributing file to learn more.