Created
October 9, 2013 05:13
-
-
Save kanemu/6896524 to your computer and use it in GitHub Desktop.
[groovy]groovyでodsを読む
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('org.jopendocument:jOpenDocument:latest.release') | |
import org.jopendocument.dom.spreadsheet.* | |
def odsPath = '/Users/kanemu/Desktop/画像整理.ods' | |
def odsFile = new File(odsPath) | |
def odsDoc = SpreadSheet.createFromFile(odsFile) | |
def odsSheetLastIndex = odsDoc.getSheetCount()-1 | |
MutableCell cell = null | |
for(int i in 0..odsSheetLastIndex){ | |
def odsSheet = odsDoc.getSheet(i) | |
int colLastIndex = odsSheet.getColumnCount()-1 | |
int rowLastIndex = odsSheet.getRowCount()-1 | |
for(int r in 0..rowLastIndex){ | |
for(int c in 0..4){ | |
cell = odsSheet.getCellAt(c, r); | |
println cell.getValue() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment