Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
fzumstein committed Nov 7, 2024
1 parent 1ee55ba commit 85854e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/custom_scripts/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

@script(target_cell="[xlwings_button]Sheet1!B4")
def hello_world(book: xw.Book):
import time

time.sleep(2)
print("xxxxxxxxxxxxxxxxxxxxxxxx")
sheet = book.sheets.active
cell = sheet["A1"]
if cell.value == "Hello xlwings!":
Expand Down
3 changes: 3 additions & 0 deletions app/routers/xlwings.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@ async def custom_functions_call(
@router.post("/custom-scripts-call/{script_name}")
async def custom_scripts_call(script_name: str, book: dep.Book, current_user: dep.User):
logger.info(f"""Script "{script_name}" called by {current_user.name}""")
empty_book = book
book = await xlwings.server.custom_scripts_call(
custom_scripts,
script_name,
current_user,
typehint_to_value={CurrentUser: current_user, xw.Book: book},
)
if isinstance(book, dict):
return empty_book.json()
return book.json()


Expand Down

0 comments on commit 85854e9

Please sign in to comment.