This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Unfortunately, that doesn't appear to do what I need. I need to read in .doc files including the values selected in a drop-down. I've found a python package called Textract which claims to do this, but I can't get it working. I'm not at all competent with Python, so it's definitely user error. I've installed the package, and defined the filepaths so I can use it, but it returns a File Not Found error.
I spoke with Support and I do have a solution that has worked for me for reading Word docs in the Python tool.
1) to install external packages you have to do it in the Admin version of Alteryx. Right click on the Alteryx icon and select 'Run as administrator'
2) drag the python tool onto the canvas and click on it. Type the following into a cell:
from ayx import Alteryx Alteryx.installPackages("docx2txt")
Keep the cell selected and hit the 'Run' button within the Python tool itself (not the Alteryx Run Workflow button)
This should install the package onto your computer. You should now be able to use it in the non-admin version of Alteryx. You should not have to do this admin step again for this package (but you will if you want to install others)
3) Open up the non-admin version of Alteryx and drag a Python tool onto the workflow
4) Now the package is installed you need to import its features into your Python kernel. Type the following into a cell:
from ayx import Alteryx import pandas import docx2txt
You need to import pandas too since the Word document conversion is to a pandas df.
5) Make sure that the Python tool is sourcing from the correct file directory where your Word document is saved; use the 'cd' (change directory) command to do this:
6) Use the following statement to read in your Word Document:
Hope this works for everyone! I've attached my test Word docx file if anyone wants to use it.
I have not got the PDF read-in to work yet but I will update if I do.