Mar-18-2020, 04:37 PM
(This post was last modified: Mar-18-2020, 04:37 PM by IrishOrigi.)
I am trying to automate a process that basically reads in values from text files into certain excel cells. I have a template in excel that will read data from various sheets under certain names. For example, the template will read in data from "Video scores". Video scores is a .txt file that I copy and paste into excel. There are 5 different text files used in each project so it gets tedious after a while and when there are a lot of projects to complete.
How can I import or copy and paste these .txt files into excel to a specified sheet? I have been using openpyxl for the other parts of this project, but I am open to using another library if it can't be done with openpxl.
I've also tried opening and reading a file, but I couldn't figure out how to do what I want with that either. I have found a list of all the files I need, its just a matter of getting them into excel.
Here is a sample of the .txt file: https://pastebin.com/FUvH6TbM
One thing I have tried to do is user pyperclip to open and copy the text file. I have that saved to a variable, so if I could somehow open excel and hit "paste" it would format fine.
If I were to manually copy all of the .txt file and paste it directly into excel, it would format absolutely perfectly. I just dont know how I can do this with Python.
Thanks in advance for anyone who helps.
How can I import or copy and paste these .txt files into excel to a specified sheet? I have been using openpyxl for the other parts of this project, but I am open to using another library if it can't be done with openpxl.
I've also tried opening and reading a file, but I couldn't figure out how to do what I want with that either. I have found a list of all the files I need, its just a matter of getting them into excel.
Here is a sample of the .txt file: https://pastebin.com/FUvH6TbM
One thing I have tried to do is user pyperclip to open and copy the text file. I have that saved to a variable, so if I could somehow open excel and hit "paste" it would format fine.
If I were to manually copy all of the .txt file and paste it directly into excel, it would format absolutely perfectly. I just dont know how I can do this with Python.
Thanks in advance for anyone who helps.