READ EXCEL XLS AND XLSX FILES IN PYTHON VS CODE | READ EXCEL WITH PYTHON | IMPORT EXCEL IN PYTHON

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome to my channel today in this python tutorial we are going to learn about reading excel files with xlrd library uh both we will read both xls and xlsx file so first we will import our we will install xlrd so for that i will come to this terminal and i will use pep install xlrd equals one point two point zero because it is just version of xlrd it does not support xzx file files so we would use this uh version 1.2.0 this is an old version and this support both xls and xlsx files so i'll click enter so it will take some time to uh get this uh now it has uh imported this accelerd or i installed this excel rd so i'll now import it so i'll use import x l r d the second one now as this is imported so i will show you the xls x file so this sample1 dot xlsx file we have 1000 records inside this so we will read this file now if i show you i'll go to the top and show you this now you can see we have this name names as well as this country and gender and there's this numbers so we will read all of them so now i'll minimize this so now we will get the workbook so i'll use wb equals xlrd dot open underscore workbook and now here it will take the path so i will go here and i'll go to downloads because this file is uh and downloads so this is our file sample one so i'll right click on this and go to it so show mo properties and now here i'll copy this path so i'll copy this path ctrl c this and now i'll come to editor and control paste this with this and i'll use backslash and here i will use a sample and one dot this one and now i'll use a backslash here as well so this error will be gone now we have the workbook so now as we have the workbox so we will get the sheet from it so um i'll use wvs per worksheet equals wb dot sheet by index and now i'll use zero here because we have only one sheet in our workbook so now to get the rows and columns so we will use for loop so far um i n arrange and i will use uh w s dot n rows first we would use rows then for j and arrange and now we would use ws dot n columns and now we will print the rows and columns so i'll use print and we will use um w s dot uh cell value i comma j and here i will use comma end equals and double quotes or single quote backslash d and now we will print an empty space print and double quotes single also so now let's run this and check this if it is working so if i run this now you can see that it is reading all the data from this xls x file sample one now i also have a sample one a sample a file which is only xls if i show you it is inside the downloads also now this is the sample xls file so now we will try to read this one with this same code so i'll remove this x from the end and i will use uh remove this one and i will use e here so this is a sample.xls file now it has the same data as this one so if i delete this and re-run this now you can see that it is reading the xls file as well so that's all for today i hope you liked the video if you like the video please like subscribe and comment thank you
Info
Channel: Programming Guru
Views: 17,176
Rating: undefined out of 5
Keywords: Programming Guru, Guru Programming, programming, gurru, programminggurru, READ EXCEL XLS AND XLSX FILES IN PYTHON VS CODE, IMPORT EXCEL FILE IN PYTHON EASILY, reading xls and xlsx file in python, python read excel files, simple excel file reading tutorial, reading excel files xls and xlsx in python, python full course, python for beginners, python tutorial for beginners, python excel automation, python excel 自動化, python excel xls and xlsx reader
Id: xjD3NX_xJWE
Channel Id: undefined
Length: 5min 56sec (356 seconds)
Published: Thu Jun 30 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.