Convert the content from multiple TXT or CSV files into Excel using Python (Real-World Example)

preview_player
ะŸะพะบะฐะทะฐั‚ัŒ ะพะฟะธัะฐะฝะธะต

๐——๐—˜๐—ฆ๐—–๐—ฅ๐—œ๐—ฃ๐—ง๐—œ๐—ข๐—ก
โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€
Learn how to save time, get organised and reduce errors by using Python scripts for importing data from TXT or CSV files straight into Excel. This tutorial will show you a real-world example of importing data from a TXT file into Microsoft Excel.

๐ŸŒ ๐—Ÿ๐—œ๐—ก๐—ž๐—ฆ:

โญ ๐—ง๐—œ๐— ๐—˜๐—ฆ๐—ง๐—”๐— ๐—ฃ๐—ฆ:
00:00 โ€“ Intro
00:16 โ€“ Problem statement
01:29 โ€“ Coding out the solution
05:55 โ€“ Outro

๐—ง๐—ข๐—ข๐—Ÿ๐—ฆ ๐—”๐—ก๐—— ๐—ฅ๐—˜๐—ฆ๐—ข๐—จ๐—ฅ๐—–๐—˜๐—ฆ
โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€

๐—–๐—ข๐—ก๐—ก๐—˜๐—–๐—ง ๐—ช๐—œ๐—ง๐—› ๐— ๐—˜
โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€โ–€

โ˜• ๐—•๐˜‚๐˜† ๐—บ๐—ฒ ๐—ฎ ๐—ฐ๐—ผ๐—ณ๐—ณ๐—ฒ๐—ฒ?
If you want to support this channel, you can buy me a coffee here:
ะ ะตะบะพะผะตะฝะดะฐั†ะธะธ ะฟะพ ั‚ะตะผะต
ะšะพะผะผะตะฝั‚ะฐั€ะธะธ
ะะฒั‚ะพั€

I hope you liked this Python automation example.
Here are the links โคต
*Happy Coding!* ๐Ÿš€

CodingIsFun
ะะฒั‚ะพั€

Hi Sven! Thank you once again for guiding us through the python automation ideas and your brilliant solutions! Me and my colleagues are grateful for your help with "merging multiply pdf''s by name" project . Thank you for your time and kindful assistance.๐Ÿ˜‡

brazilleros
ะะฒั‚ะพั€

Another practical cool tutorial from the legend. Thank you ๐Ÿ˜Š

TimePasser
ะะฒั‚ะพั€

It is really helpful ! Thank you so much :)

sujungpark
ะะฒั‚ะพั€

Very nice example! I have a small question, why do you define the current_dir like that? I am always using something like os.getcwd() but now I am not sure if this is more efficient or not. Would you know if there is any difference? Thanks in advance and congratz for your content!

MrDanilofontana
ะะฒั‚ะพั€

Hi Sven,
Thanks for the detailed coding explanation. It is very helpful.
I also wnonder, if you change the file name from Student_number_Eng/Math to Student_Eng/Math_number, how would you change your code? Let say, the student number is from 001 to 100. I tried to use for loop, but it seems like python doesn't like it.

rdtw
ะะฒั‚ะพั€

Hi, it is very helpful. I have an issue when I tried to do this. I got with xw.App(visible=False) as app: AttributeError: __enter__ . Do you know why it happens. Thank you.

zhecao
ะะฒั‚ะพั€

Greetings
I have tons of files to process and I need to merge daily data files to monthly. Also, each file contains headings (55 lines) and the main body (343 lines).
please assist. NB: the file extension is .trop

ibrahimsaiusman
ะะฒั‚ะพั€

When i'm defining current_dir i'm getting an error "cwd() takes 1 positional arguments bur 2 were given"

leonpheonix
ะะฒั‚ะพั€

f you are unable to do . open the terminal in the directory and run this command .
"Get-ChildItem -Filter *.txt | Rename-Item -NewName { $_.Name -replace '\.txt$', '.csv' }"

here i am converting txt files to csv files, replace on that you want to convert .

udayrajvadeghar