Yes, it's possible, but with one caveat. If you want to specify the path of the file to import then the script has to run from a trusted context, such as a folder-level script file. Otherwise you'll be prompted to select the file each time you click the button. If you're OK with that all you need is the following code:
Thank you for the reply, this works perfectly for what I need.
I did see you mention that any other way would need to run from a trusted context, how would I go about that for this type of situation? While I will be using the java you provided, maybe I can use the other method for a different document.
Basically you would need to write a trusted function and place it in a .js file that's located in a specific folder on each computer. Then the button could call that function, passing the path of the text file to it as a parameter and it would import the data from it directly.