Overview: AIMMS Excel Library¶
The AimmsXLLibrary can communicate with Excel files in server environments where Excel is not installed.
This library is especially useful when building WebUI apps for AIMMS PRO in a server environment.
The procedure follows the basic workflow illustrated below.
Functions included with the AXLL library have a prefix
Importing data from Excel files¶
Add the AIMMSXLLibrary Library.
Go to File > Library manager.
Click Add System library… and select AIMMSXLLibrary. Click OK.
Create a procedure.
Create a procedure to import data from the Excel document. For example,
Open the Excel file:
axll::OpenWorkBookto open your workbook.
Tip: If you send a command to open a workbook which is already open, AIMMS raises an error. You can use an
IFblock to check whether a workbook is open or not, and open if it is closed or otherwise select the open workbook.
WorkBookName := "zipcode-database.xlsx"; if axll::WorkBookIsOpen(WorkBookName) then axll::SelectWorkBook(WorkBookName); else axll::OpenWorkBook(WorkBookName); endif;
Specify a sheet of the workbook.
axll::SelectSheetto specify which sheet of the workbook to pull data from.
sp_Sheet := "Example"; axll::SelectSheet(SheetName : sp_Sheet );
Import data from the Excel file to your AIMMS project.
Use the appropriate
axll::function to read data from the Excel sheet.
The ReadTable statement will be:
axll::ReadTable( IdentifierReference : MyValue, RowHeaderRange : "A8:D18", ColumnHeaderRange : "E4:K7", DataRange : "E8:K18");
axll::ReadSetto read in data for the set
axll::ReadSet( SetReference : sStates, SetRange : "D2:D42523", ExtendSuperSets : 1);
axll::ReadListto read in data
ZipCodeState(z), which holds the state name that each zip code belongs to.
axll::ReadList( IdentifierReference : ZipCodeState(z), RowHeaderRange : "A2:A42523", DataRange : "D2:D42523");
Close the Excel file.
axll::CloseWorkBookto close the workbook.
Run the procedure.
Run the procedure to import the data to your model. You can use the imported data for further operations and analysis.
Was this helpful ?
Last Updated: May, 2019