how to read an excel file in pycharm | how to read an excel file in python

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] okay guys it's me amat from nelson darwin park tech youtube channel today in this video tutorial we will learn about how to read an excel file within the pycharm python compiler so how we can do it first of all there is a specialized library called as excel reader xlrd so you should have to import it out so you need to write import xlrd and while importing it for the first time it will show an error okay so you need to click on this sign and here there is an option for to install this module so you can click it and your error will be gone after this thing we need to [Music] write any variable and here our variable is location it is just a variable you can write any other thing here like lock or locate or anything like location and what it will do it will take our path in store store the location inside this location variable like here we will enter a path part of the file which is need to be read okay so we will go for our file and here you can see that our file name is era so we need to click on this error and we will go to properties now its location is in the drive d its name is error and dot xls is the extension so we will write here like this we will write here error dot x l s okay so this path our path is stored inside this variable so rather than the whole path we just need to write location and our compiler will get the path now we need to declare one more variable and that is we can call it as where for work book okay okay you can write w b r w r b k or anything okay if you want okay it is a little bit complex so you can write a simple variable as well now we will write excel rd dot open underscore workbook underscore workbook and here you need to put the location variable so location means this location now open underscore workbook is actually a specialized built-in function of the xlrd library so that is why they have a simple dot sign in between them so open workbook will be inside this library and after and what this function will do it will just read the whole or open the workbook that is our excel file and then store all the data in variable underscore workbook variable so all this will be replaced by this simple variable after it we need to write for sheet okay we need to write to first this function has opened the workbook so after it we need to write for sheet like if you want sheet is equal to sheet is equal to so first we will copy this uh it's called as the variable for workbook and then dot after this thing after this thing we need to write sheet underscore by underscore index of zero okay now what about this variable this variable is having all this information in it okay so rather than this library this function and location we are just writing this variable and dot sheet by index is a specialized function and dot 0 means that our sheet is 0 okay sheet is like at 0 okay because in workbook and whole you can see that we have this is sheet number okay here it is zero but okay it it will treat it as the zero zero at zero index okay and we also have written ali adnan michael and joan in it so these are our four elements now in the last we will print all these components okay after reading so print sst dot now sst is this variable which is containing all these information in it okay so print sst dot cell underscore value now it will read this cell this function dot cell underscore value dot cell underscore one comma zero okay one comma zero so it this will print uh row one and column zero value okay so what we will get we will get all along what's called as the uh on console so we will run it out so so we if we got adnan okay uh now because it is in hetero uh number first okay no no we will write 0 and 0 i think we will get early okay early okay because it is at row 0 column 0 and what about row 2 and column 0 i think it is john or michael so it is michael and what about this third one it will be john so hopefully you got the concept that how we can fetch a simple value from any cell within the uh excel file with the help of python pycharm compiler so hopefully you got the concept so thanks for visiting our channel and don't forget to subscribe
Info
Channel: Nelson Darwin Pak Tech
Views: 42,766
Rating: undefined out of 5
Keywords: how to read an excel file in pycharm., how to read an excel file in python., simplest code to read an excel file in pycharm., simplest program to read an excel file in pycharm, best way to read an excel file in python, reading an excel file in pycharm/python, easiest way to read an excel file in pycharm
Id: DJGgkBVlRlY
Channel Id: undefined
Length: 7min 20sec (440 seconds)
Published: Sun Dec 19 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.