What is the best solution to create a script for importing a text file in excel?

824 views Asked by At

I want to know what is the best way to create a script in any language for importing a text file in excel. I use to code in java but I'm interrested to learn any other language.

The goal is to import a txt file in excel without opening excel for example using java or vb...

I have a folder where everyday a text file is downloaded and I want to import it in excel and the I could check for graphs.

I tried to import it in java, but it seems it's not possible.

Thank you for your help.

2

There are 2 answers

2
bits On BEST ANSWER

I think the best way would be to convert your text file into a .CSV file (Comma Separated Values).

Use whatever language you like, but I would suggest a scripting language like preferably Python.

EDIT: Forgot to mention earlier that CSV files open up in excel by default.

0
redOctober13 On

Only 10 years late to this party, but I just searched for this questions here in futureland. I know you said "without opening Excel," but unless you make a script that checks for a file and is scheduled with a CRON job or something, you have to do something to convert the file.

I've done it in VBA many times when I wanted Excel output, as it's pretty straightforward to open a file, read it, and put it in Excel however you want, and then you have all the functionality of Excel natively (say if you wanted to make graphs). I've made decent UIs with buttons so the user only has to open the file and click a button to import a text file.

Apart from that, Python and Pandas works pretty well and is pretty flexible; you just have to have a way to execute the script, either manually or on some schedule.