Skip to content

Commit

Permalink
Add LEFT function.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Monson committed Oct 20, 2020
1 parent f3d87cd commit dad2be1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions koala/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* SUMIF
* AVERAGE
* RIGHT
* LEFT
* INDEX
* LOOKUP
* LINEST
Expand Down
7 changes: 7 additions & 0 deletions koala/excellib.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"ISBLANK",
"ISNA",
"ISTEXT",
"LEFT",
"LINEST",
"LOG", # Python function, not defined here
"LOOKUP",
Expand Down Expand Up @@ -503,6 +504,12 @@ def istext(value):
return type(value) == str


def left(text,n=1):
if isinstance(text, str):
return text[:n]

return ExcelError('#VALUE!', 'Input value must be text')

# NEEDS TEST
def linest(*args, **kwargs): # Excel reference: https://support.office.com/en-us/article/LINEST-function-84d7d0d9-6e50-4101-977a-fa7abf772b6d

Expand Down
1 change: 1 addition & 0 deletions koala/functions.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"ISBLANK",
"ISNA",
"ISTEXT",
"LEFT",
"LINEST",
"LOG",
"LOOKUP",
Expand Down

0 comments on commit dad2be1

Please sign in to comment.