Skip to content

Commit

Permalink
Update excel.py
Browse files Browse the repository at this point in the history
  • Loading branch information
marcantondahmen committed Nov 5, 2020
1 parent 6078cf4 commit 75ef0e4
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions revitron/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
book = revitron.ExcelWorkbook(xlsx)
sheet = book.newWorksheetFromTemplate('Template', 'Name')
sheet.cell(5, 1, 'Value')
sheet.setCell(5, 1, 'Value')
"""
import clr
clr.AddReference("Microsoft.Office.Interop.Excel")
Expand Down Expand Up @@ -37,6 +37,19 @@ def close(self, save = True):
if save:
self.workbook.Save()
self.workbook.Close(SaveChanges=save)


def getWorksheet(self, name):
"""
Returns a Excel worksheet for a given name
Args:
name (string): The worksheet name
Returns:
object: An Excel worksheet object instance
"""
return ExcelWorksheet(self.workbook.Worksheets(name))


def newWorksheetFromTemplate(self, template, name):
Expand Down Expand Up @@ -71,7 +84,7 @@ def __init__(self, worksheet):
self.worksheet = worksheet


def cell(self, row, column, value):
def setCell(self, row, column, value):
"""
Writes data to a cell of the current worksheet.
Expand Down

0 comments on commit 75ef0e4

Please sign in to comment.