wooey / Wooey

A Django app that creates automatic web UIs for Python scripts.
http://wooey.readthedocs.org
BSD 3-Clause "New" or "Revised" License
2.12k stars 182 forks source link

XLS file import process #312

Closed richardnguyen5 closed 4 years ago

richardnguyen5 commented 4 years ago

Hi Wooey team, is there documentation on importing data from an XLS file into Wooey? Or an example of a Python script that reads an XLS file into Wooey?

I'm trying to adapt some Python scripts into Wooey but keep running into errors with the XLS import process.

Thanks for sharing this platform with the community!

Chris7 commented 4 years ago

Can you let me know what you are trying to do? Providing an argument to a script is supported (via the file types in argparse). Some example scripts we have in the Wooey test suite for these like https://github.com/wooey/Wooey/blob/master/wooey/tests/scripts/choices.py. Generally, you would use something like: parser.add_argument('--xls-file', type=argparse.FileType('r')) in your argparse

Maybe a link to the script you are attempting to import?

richardnguyen5 commented 4 years ago

Hi Chris,

My use case with Wooey is to read data from an input XLS file, run some data manipulation, and then output the results into an XLS file.

This is the basic test script i am running to validate that use case. It runs correctly in Wooey, but the output file is empty. I've attached a screenshot of the result page too.

The input XLS file i used for that test is just a Excel file with a string value in cell B2.

test XLS input output
richardnguyen5 commented 4 years ago

Thanks Chris, your suggestion worked. I had to name the output file such as "output.xlsx" or default that value within my script. Thanks!

I think the problem is this is writing to a buffered file that never actually exists outside of the program. At the end, you could write the buffered output to a file with output_file.name