All pastes #374310 Raw Edit

Miscellany

public java v1 · immutable
#374310 ·published 2007-02-27 14:10 UTC
rendered paste body
import org.codehaus.groovy.scriptom.ActiveXProxyimport java.io.File;// create a proxy for Exceldef xls = new ActiveXProxy("Excel.Application")xls.Visible = falseThread.sleep(1000)// open a filexls.WorkBooks.Open(new File("53Bites.xls").canonicalPath)// get the workbooks objectdef workbooks = xls.Workbooksdef workbook = xls.ActiveWorkBook// select the active sheetdef sheet = workbook.ActiveSheetdef labelRow = "I"def valueRow = "J"for (i in 100..199) {    def sl = sheet.Range(labelRow+i)    def sv = sheet.Range(valueRow+i)    label = sl.Value.value    if (label != null && label.equalsIgnoreCase("Soup of the Day")) {        println "Soup of the Day is: ${sv.Value.value}"    }}// close the workbook without asking for saving the fileworkbook.Close(false, null, false)// quits excelxls.Quit()