Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
Expand all | Collapse all

Writing OPL results to excel sheet

  • 1.  Writing OPL results to excel sheet

    Posted Mon February 10, 2014 05:08 AM

    Originally posted by: mbaddar1


    Hello Everybody

    i want to write OPL decision variable results to excel sheets , 

    in the "oil" example

    ===========

    SheetConnection sheet("oilSheet.xls");
    Gasolines from SheetRead(sheet,"'gas data'!A2:A4");
    Oils from SheetRead(sheet,"'oil data'!A2:A4");
    Gas from SheetRead(sheet,"'gas data'!B2:E4");
    Oil from SheetRead(sheet,"'oil data'!B2:E4");
    MaxProduction = 14000;
    ProdCost = 4;
     
     
    a to SheetWrite(sheet,"RESULT!A2:A4");
    Blend to SheetWrite(sheet,"RESULT!B2:D4");

    =============

    it reads and writes to already a created file

    what should i do to create a new results sheet from OPL script and specify a named range ?

    thanks and best regards


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: Writing OPL results to excel sheet

    Posted Mon February 10, 2014 09:39 AM

    There is a separate forum for pure OPL questions. You may find a better answer there.

    If nothing else helps, I guess you can create an empty spreadsheet file (as a sort of template) and use OPL Script to copy it into the right place before you create the SheetConnection.


    #CPLEXOptimizers
    #DecisionOptimization