| 35 |
|
"Get Value of one Cell" |
| 36 |
|
sht = self.xlBook.Worksheets(sheet) |
| 37 |
|
return sht.Cells(row,col).Value |
| 38 |
+ |
|
| 39 |
|
def setCell(self, sheet, row, col, value): |
| 40 |
|
"set value of one cell" |
| 41 |
|
sht = self.xlBook.Worksheets(sheet) |
| 46 |
|
sht = self.xlBook.Worksheets(sheet) |
| 47 |
|
return sht.Range(sht.Cells(row1,col1), sht.Cells(row2,col2)).Value |
| 48 |
|
|
| 49 |
< |
def setRange(self, sheet, leftCol, topRow, data): |
| 49 |
> |
def setRange(self, sheet, leftCol, topRow, data, sheetRenameValue = None): |
| 50 |
|
"""insert a 2d array starting at given location. |
| 51 |
< |
works out the size needed for itself""" |
| 52 |
< |
bottomRow = topRod + len(data)-1 |
| 51 |
> |
works out the size needed for itself. optionally you can rename the sheet.""" |
| 52 |
> |
bottomRow = topRow + len(data)-1 |
| 53 |
|
rightCol = leftCol + len(data[0]) -1 |
| 54 |
|
sht = self.xlBook.Worksheets(sheet) |
| 55 |
|
sht.Range( |
| 56 |
|
sht.Cells(topRow, leftCol), |
| 57 |
|
sht.Cells(bottomRow, rightCol)).Value = data |
| 58 |
+ |
if sheetRenameValue: |
| 59 |
+ |
sht.Name = sheetRenameValue |
| 60 |
|
|
| 61 |
|
def getContiguousRange(self, sheet, row, col): |
| 62 |
|
"""Tracks down and across from top left cell until it |