Skip to content

Instantly share code, notes, and snippets.

@daicham
Created May 17, 2013 02:46
Show Gist options
  • Save daicham/5596593 to your computer and use it in GitHub Desktop.
Save daicham/5596593 to your computer and use it in GitHub Desktop.
Read a Excel file by Groovy (GExcelAPI) - http://nobeans.hatenablog.com/entry/2013/03/21/003309
// Proxy 設定は %USERPROFILE%\.groovy\preinit.bat に JAVA_OPTS として記述する。
// ex.)
// set JAVA_OPTS=%JAVA_OPTS% -Dhttp.proxyHost=proxyserver -Dhttp.proxyPort=8080 -Dhttp.proxyUser=username -Dhttp.proxyPassword=secret
// set JAVA_OPTS=%JAVA_OPTS% -Dhttps.proxyHost=proxyserver -Dhttps.proxyPort=8080 -Dhttps.proxyUser=username -Dhttps.proxyPassword=secret
@GrabResolver(name="kobo", root="https://repository-kobo.forge.cloudbees.com/release")
@Grab("org.jggug.kobo:gexcelapi:0.3")
import org.jggug.kobo.gexcelapi.GExcel
def book = GExcel.open(args[0])
book.sheets.each { //シートのループ
println it.sheetName
it._1.each { //1行目のセル分ループ
println " ${it.value}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment