Subject: Importing New Branches into WEAP from Excel Posted: 4/28/2016 Viewed: 1524 times
I am developing a water management model of certain African countries in WEAP. I had to make a 'Key Assumption' to represent 1000 small districts and their population. I was wondering if I could have it in Excel and directly import them into WEAP. But i did some digging on the user Manuals and it had the following words
"WEAP can only import data that corresponds to an existing branch/variable/scenario"
So i believe that I need to create these 1000 branches in WEAP and then I can use the import/export function to deal with the EXPRESSIONS.
Can someone guide me if my understanding is right and if wrong, how do i take numerous amount of branches into WEAP without clicking and adding them one by one.
Subject: Re: Importing New Branches into WEAP from Excel Posted: 4/28/2016 Viewed: 1523 times
You can use the WEAP Application Programming Interface (API) to automate the adding of branches. See the WEAP help topic for more information: Advanced Topics \ Automating WEAP (API).
Here's the Visual Basic Script (VBS) code you use to create 1000 branches, named with sequential numbers:
Set ParentBranch=WEAP.Branch("\Key Assumptions")
For i = 1 to 1000
Set NewBranch = ParentBranch.AddChild("Branch " & i)
If you have the names of the new branches in an Excel spreadsheet, you could use Excel's Visual Basic for Applications (VBA) language to write a simple macro that would create branches using names from Excel cells. For more information on controlling WEAP from Excel, see the Help topic: Advanced Topics \ Automating WEAP (API) \ Exploring the API.
Subject: Re: Importing New Branches into WEAP from Excel Posted: 5/9/2016 Viewed: 1470 times
Thanks for the help. It definitely reduces a lot of downtime.
Topic "Importing New Branches into WEAP from Excel"