How to write excel file in Selenium using Apache POI

  Рет қаралды 143,977

Mukesh otwani

Mukesh otwani

Күн бұрын

Пікірлер: 207
@sanketd954
@sanketd954 2 жыл бұрын
Finally, a good video to understand the concept. went through all the links and videos but clearly the best video.
@pavanigayathri4737
@pavanigayathri4737 6 жыл бұрын
This is really helpful. What I liked is this video is up to point. Thanks for knowledge sharing Mukesh.
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Thanks Pavani :) Keep learning.
@SangeethasCreation
@SangeethasCreation 2 жыл бұрын
Very clear explanation. Thankyou
@Mukeshotwani
@Mukeshotwani 2 жыл бұрын
Glad it was helpful! Sangeetha
@sravanreddy8718
@sravanreddy8718 9 жыл бұрын
Excellent tutorial, Very clear and easy to understand, Watched both the videos how to read and write in excel sheet. Thanks Mukesh
@Mukeshotwani
@Mukeshotwani 9 жыл бұрын
+sravan reddy Thanks Sravan Reddy
@SumanKumari-qk4lr
@SumanKumari-qk4lr 6 жыл бұрын
Easy and simple to understand. Great work.Thanks!
@何承恩-g5w
@何承恩-g5w 6 жыл бұрын
很棒的Apache POI教學 ,不過要注意使用版本需與影片中一致, 謝謝Mukesh otwani 提供這麼棒的教學!
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
非常感謝你這麼好的評論。當然,我會繼續創建新版本的視頻。 謝謝 Mukesh Otwani
@shivaprasad8804
@shivaprasad8804 4 жыл бұрын
Thank you so much, Mukesh...You saved my day..
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Happy to help Shiva, Have a nice weekend.
@nirmalrawtani4961
@nirmalrawtani4961 3 жыл бұрын
Very helpful. Thanks Mukesh :)
@Mukeshotwani
@Mukeshotwani 3 жыл бұрын
Most welcome! Nirmal.
@devendrapawar2425
@devendrapawar2425 3 жыл бұрын
Exactly I was looking for 🤗
@prashantsaini86
@prashantsaini86 6 жыл бұрын
Awesome and really Helpful video thanks a lot......
@guidingbird
@guidingbird 8 жыл бұрын
You are a Great Teacher :) Thank You So much , being new to selenium was tough until i got you :)
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Hey Trick, I am glad to know it helped :) Yes Selenium is quite easy. Long way to go and let me know if any help.
@MrAmarSindol
@MrAmarSindol 6 жыл бұрын
Thanks Mukesh, I learned reading and writing the excel data
@srinivasraghupatruni3036
@srinivasraghupatruni3036 7 жыл бұрын
Great Trainer. Good Work Mukesh (Y)
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Thanks Srinivas
@reenalodhi8723
@reenalodhi8723 6 жыл бұрын
very clear explanation...........
@ronwab
@ronwab 7 жыл бұрын
Thanks Man you are very eloquent and easy to follow. very well prepared presentation for us beginner. Keep up the good work.
@nk2k123
@nk2k123 6 жыл бұрын
Thanks for the easy explanation... Really helpful.. Appreciate your effort
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Thanks Mate
@itssumanmsk
@itssumanmsk 4 жыл бұрын
Nice videos. U should have explained both read and write in 1 video including 2 dimensional array values. U shown how to retrieve the data in single column.
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Sure Suman, will record new video on this too.
@ruchinkhare2990
@ruchinkhare2990 7 жыл бұрын
Again Great Explanation and Tutorial :)
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Thanks Ruchin
@vyasarajv9841
@vyasarajv9841 7 жыл бұрын
@Mukesh - Nice explanation bro...keep up the good work. Do share more such videos. Thanks!
@omkaryallavula2939
@omkaryallavula2939 7 жыл бұрын
i 'm learn more from this video..
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Thanks Omkar, Keep learning.
@nk2k123
@nk2k123 6 жыл бұрын
true
@dev3726
@dev3726 7 жыл бұрын
Hi Mukesh, I would like to ask something, in my scenario I want to save the search result of a google search into an excel sheet? How should I proceed, please advise. Thanks
@Ashish15Mathew
@Ashish15Mathew 8 жыл бұрын
Appreciate ur time and work.. Great explanation..!!! Thanks
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
+ashish mathew Thanks Ashish :) Keep visiting and check other videos as well.
@Ashish15Mathew
@Ashish15Mathew 8 жыл бұрын
Welcome Mukesh.. If possible please upload videos on Hybrid framework ,Cucumber and Protractor from the scratch.. Would be really help full
@kushanchoudhury1942
@kushanchoudhury1942 6 жыл бұрын
Hi Mukesh, Please help me in using Loop statement for writing the data in the excel sheet so that we dont have write for all the rows one after the other.I am not able to get the logic for writing the loop statement here.
@myWayIn619
@myWayIn619 4 жыл бұрын
Hi! Quick question, how would you go about getting text from a box and place it in a excel sheet? Thank!
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Hello Frank Perez, its easy you can capture text from selenium using getText() and it will return as String which you can pass in excel for writing into cell.
@myWayIn619
@myWayIn619 4 жыл бұрын
@@Mukeshotwani I will try, THanks!
@rajsep1
@rajsep1 7 жыл бұрын
Hey Mukesh thanx alot for uploading these valuable videos this is very helpful. Can u help reagrding what getTableArray method is ? Can this method be used with Apache poi?
@saifk8593
@saifk8593 7 жыл бұрын
thanks so much. great teacher
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Thanks Shafiul bhai :)
@gomathigalaxy513
@gomathigalaxy513 6 жыл бұрын
Hi Mukesh, Are we able to pass the output of one row as an input value to other row.
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Yes Gomathi it is up to your requirement Once you know how to read and write excel then you can play with it.
@rohitmehta3812
@rohitmehta3812 4 жыл бұрын
Hi Mukesh, how to write values from a refresh row in excel sheet?
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Hi Rohit please use createRow to create new row in excel.
@rohitmehta3812
@rohitmehta3812 4 жыл бұрын
@@Mukeshotwani ya, I missed, thats why was getting NullPointerException, thanks mukesh for replying, much appreciated!!
@gopikrishnan8182
@gopikrishnan8182 9 жыл бұрын
Good explanation..... Can you write excel file in Selenium using jxl ?
@Mukeshotwani
@Mukeshotwani 9 жыл бұрын
+gopi krishnan Hi Gopi, yes we can do.
@pragtigupta5675
@pragtigupta5675 8 жыл бұрын
Hi Mukesh, very thanks. can u plz tell me if I want to write gmail code with a list of diff usname and pwd then what I ve to do in poi code ?
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Hi Pragti, here we go kzbin.info/www/bejne/lWi7e5ikiduFaZY
@rajinder_kaur13
@rajinder_kaur13 5 жыл бұрын
How to store values on a new just created Excel sheet from fileoutstream. The above example is for that case where the file is there already and we just writing it.
@pnagendra5456
@pnagendra5456 7 жыл бұрын
Hi Mukesh, Great explanation. Please help me how to write the data in Excel by default sheet2 without mentioning the sheet name in the method.
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Hi Nagendra, As per methods you have to provide sheet name or index.
@pnagendra5456
@pnagendra5456 7 жыл бұрын
Thank you for your reply. This question asked in the interview.
@pavanigayathri4737
@pavanigayathri4737 6 жыл бұрын
You can use some global variables and pass the value into method call. But this is as good as mentioning your sheet name inside Method, this makes a difference when you are referring this sheet in multiple methods.
@gilsonsouza8159
@gilsonsouza8159 3 жыл бұрын
Hi, How so save the excel file using Selenium after write and add some rows?
@Mukeshotwani
@Mukeshotwani 3 жыл бұрын
yes you can call write method after every execution.
@anandkrishan9054
@anandkrishan9054 8 жыл бұрын
Hi Mukesh, I am new to Java just started but I want to read some of the selective columns from one Excel sheet and want to write to another excel sheet.. can you please suggest..
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
+Anand Krishan Hi ANand you can change the getSheet index and it will return the Sheet
@creativesketchs4116
@creativesketchs4116 6 жыл бұрын
you can use iterator
@sankalpboradkar8682
@sankalpboradkar8682 6 жыл бұрын
Hey! I am not being able to write the result of executed test data into its respective cell index. It would be great if you can have a video which concludes that :)
@arafatkpi
@arafatkpi 8 жыл бұрын
Good explanation.....#Mukesh
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
+Arafat Hossain Hi Arafat welcome.. Keep visiting..
@shraddhagupta3455
@shraddhagupta3455 8 жыл бұрын
Hi Mukesh, Your explanations are good, it helps me a lot. Can you please tell me how to copy data from one excel sheet to another using Java?
@9970888631
@9970888631 7 жыл бұрын
Thanku Very much Mukesh :)
@harshchoubey9168
@harshchoubey9168 4 жыл бұрын
Excellent way of teaching.
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Thanks for liking Harsh
@magicalsurprise1151
@magicalsurprise1151 6 жыл бұрын
Hi how do we write WebElement values in to excel in this way
@preetrandhawa9344
@preetrandhawa9344 7 жыл бұрын
hello sir.i have one question... at time of write excel only sheet1 in working... how we can write on sheet2....when i am passing (1)..not working
@kalavathijeeru9605
@kalavathijeeru9605 5 жыл бұрын
Hai,sir Is there video for how to copy the one excel file contents to another excel file
@veeraratna
@veeraratna 7 жыл бұрын
Thank you for your time
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Welcome Ratna. Don’t forget to subscribe my KZbin Channel
@chetansahu8108
@chetansahu8108 5 жыл бұрын
Hi Mukesh, I'm working on localization I would like to know how can I Write code for write Excel sheet in the data-driven framework. actually, I'm localizing the UI of a desktop base application so I want that after verification of the labels I want to Write that what I got from application to an excel sheet. for a single class as you explain in the video I understood kindly help me manage it with the framework .
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Hi Chetan, what issues you are getting while implementing this ?
@chetansahu8108
@chetansahu8108 4 жыл бұрын
@@Mukeshotwani I'm unable to understand where should I write those code in data-driven framework. how should I make it dynamic I tried to write the logic in the read from excel class by creating new method same I did for read excel it is not working some error like type mismatch is coming"can not convert from void to string" I'm attaching my code below please let me know what is the problem and how can I overcome it. package dataprovider; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import windows.LoginWindow; public class ReadExcelData { XSSFWorkbook wb; XSSFSheet sheet1; public ReadExcelData() { File src = new File("E:\\KDS_workspace\\KayPentax_KDS_Localization\\Test Data\\loginLables.xlsx"); try { FileInputStream fis = new FileInputStream(src); wb= new XSSFWorkbook(fis); sheet1 = wb.getSheet("Login"); } catch (FileNotFoundException e) { System.out.println(e.getMessage()); e.printStackTrace(); } catch (IOException e) { System.out.println(e.getMessage()); } } public String getExcelSheetData(String sheetname, int row , int column) { String data= wb.getSheet(sheetname).getRow(row).getCell(column).getStringCellValue(); return data; } public String writeExcelSheet(int row, int cell , String value) { XSSFSheet sheet1 = wb.getSheet("src"); String excel = sheet1.getRow(0).createCell(9).setCellValue(value); return excel; }
@mauryar16
@mauryar16 5 жыл бұрын
Thank you Mukesh
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
Most welcome Rajendra 😁
@parasjoshi5509
@parasjoshi5509 5 жыл бұрын
Yo mukesh, How to create an user define method for WRITE EXCEL SHEET ?
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
Hi Paras, in same way you can create for write excel like we did for read excel. One thing to keep in mind that always call write method as well.
@parasjoshi5509
@parasjoshi5509 5 жыл бұрын
@@Mukeshotwani My man Mukesh can you help me with this ?How to read numeric and date values from Excel using colname ..? Please make a video or blog on it ... It will be helpfull for us .
@ashwinilohar1169
@ashwinilohar1169 5 жыл бұрын
Hello sir Exception in thread "main" org.apache.poi.EmptyFileException: The supplied file was empty (zero bytes long). Please tell me how to solve this exception
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
HI Ashwini, it means you are trying to read empty excel.
@faissrizz
@faissrizz 7 жыл бұрын
Superb!!!
@mamtamahajan642
@mamtamahajan642 4 жыл бұрын
How can I copy excel data and paste it into my web page? Is it possible using Apache POI, If not then what concept we should use? Please reply.
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Hi Mamtha, we can use. You can read the data from excel store in variable and use the same in sendKeys. I have created below video to explain the same. learn-automation.com/data-driven-framework-in-selenium-webdriver/
@mamtamahajan642
@mamtamahajan642 4 жыл бұрын
@@Mukeshotwani Thank You so much sir, It is really helpful
@nesrinegmati1158
@nesrinegmati1158 7 жыл бұрын
please i want to write same thing in multi cell for example for E7 to E12 in same row
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Hi Nesrine did you get solution for this?
@nesrinegmati1158
@nesrinegmati1158 7 жыл бұрын
No, I didn't :(
@pankajshrivastava968
@pankajshrivastava968 4 жыл бұрын
how to write data using column name and i need to write N number of rows
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
What issue you are facing Pankaj while writing excel?
@pankajshrivastava968
@pankajshrivastava968 4 жыл бұрын
@@Mukeshotwani Thanks for the reply Sir I am uploading some data using xlsx apache poi and it has approximately 2500 records after uploading data we need to mark status as completed in a status column . I have written a code with ref. Of your video but when I am expecting script it is not writing data into Excel for all records it is marking for only one record as completed
@pankajshrivastava968
@pankajshrivastava968 4 жыл бұрын
public class WriteDataIntoExcel { public FileInputStream fis = null; public FileOutputStream fos = null; public XSSFWorkbook workbook = null; public XSSFSheet sheet = null; public XSSFRow row = null; public XSSFCell cell = null; String xlFilePath; public WriteDataIntoExcel(String xlFilePath) throws Exception { this.xlFilePath = xlFilePath; fis = new FileInputStream(xlFilePath); workbook = new XSSFWorkbook(fis); fis.close(); } public boolean setCellData(String sheetName, String colName, int rowNum, String value) { try { int col_Num = -1; sheet = workbook.getSheet(sheetName); row = sheet.getRow(0); for (int i = 0; i < row.getLastCellNum(); i++) { if (row.getCell(i).getStringCellValue().trim().equals(colName)) { col_Num = i; } } sheet.autoSizeColumn(col_Num); row = sheet.getRow(rowNum - 1); if(row==null) row = sheet.createRow(rowNum - 1); cell = row.getCell(col_Num); if(cell == null) cell = row.createCell(col_Num); cell.setCellValue(value); fos = new FileOutputStream(xlFilePath); workbook.write(fos); fos.close(); } catch (Exception ex) { ex.printStackTrace(); return false; } return true; }}
@pankajshrivastava968
@pankajshrivastava968 4 жыл бұрын
I have declared one global variable named as int count =1; And in a loop I am incrementing by count + 1
@ashwiniajagekar523
@ashwiniajagekar523 5 жыл бұрын
sir how to get when one type cell then type other​ row cell from excel to Apche poi
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
Hi Ashwini I did not get your question. Can you explain me what is your query?
@kusalmallick286
@kusalmallick286 3 жыл бұрын
can u please share the code how to reuse this as u did in read excel in last video.. please im getting error
@Mukeshotwani
@Mukeshotwani 3 жыл бұрын
Hi Kusal I have code on my blog learn-automation.com/read-and-write-excel-files-in-selenium/
@mahendra6273
@mahendra6273 6 жыл бұрын
I have give the data from Excel and out put in the same in the Excel format possible
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
Yes Mahendra if you want the data in same file then you can give path of the excel which you are reading..
@mohammadmajumdar8097
@mohammadmajumdar8097 8 жыл бұрын
Good Job
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
+Mohammad Majumdar Thanks Majumdar
@kayathiridevik5128
@kayathiridevik5128 5 жыл бұрын
Hi sir i am new to java,u have created library file for read,can we do same thing for write also.if so please help me on that
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
Sure I will do the same in upcoming videos
@raghurao300
@raghurao300 5 жыл бұрын
@@Mukeshotwani can u make viedo same for write excel
@rohanagarwal6856
@rohanagarwal6856 4 жыл бұрын
I am running this code and getting an error of NoClassFoundException.... Can you please help me on this.
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Hi Rohan are you using maven project or normal project. If you are using normal java project then use maven project and provide apache poi dependencies.
@kalyanijoshi6884
@kalyanijoshi6884 5 жыл бұрын
Hi Mukesh, My excel is getting corrupted while writing to excel. 0 kb file is created after few records are added
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
Hi Kalyani please share your code. Make sure you call write method at last.
@aekanshgupta9138
@aekanshgupta9138 4 жыл бұрын
hey, I am getting error java.lang.NullPointerException while I was trying to write the data in excel sheet. I followed the same steps as you mentioned
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Hi Aekansh please debug your code because NullPointerException is very common Java exception. May be some of the variables you are not initializing.
@aekanshgupta9138
@aekanshgupta9138 4 жыл бұрын
@@Mukeshotwani Thanks it worked :D
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
🙏🙏
@lliiiBodyiiill
@lliiiBodyiiill 6 жыл бұрын
how to set data from website ?? thanks
@shankarachary3309
@shankarachary3309 6 жыл бұрын
I have date issue to write date in excel sheet...i entered date and want to upload excel sheet. but displayed null pointer exception. please help. Thanks in advance
@raheelahmed9121
@raheelahmed9121 4 жыл бұрын
Hello sir, I am geeting an exception {java.lang.NullPointerException: "Cannot invoke "org.apache.poi.xssf.usermodel.XSSFRow.createCell(int)" because the return value of "org.apache.poi.xssf.usermodel.XSSFSheet.getRow(int)" is null at resources.RandomNumberTest.main(RandomNumberTest.java:29)} please help
@Mukeshotwani
@Mukeshotwani 4 жыл бұрын
Hi Ahmed NullPointerException is general java exception do watch this video to fix this kzbin.info/www/bejne/qIm7lnucq8eXmtE
@kirtipandit9149
@kirtipandit9149 7 жыл бұрын
Hi Mukesh , I wana ask something. Cant we give the parameter (If we stored the result in parameter) in setcellvalue(). few lines of code : (Parameter is 'location') WebElement location = driver.findElement(By.xpath("//*[@id='wrapper']/section/div/div/div[1]/div[7]/div/table/tbody[2]/tr/td[2]")); FileOutputStream FOS = new FileOutputStream(src); wb.write(FOS); sheet1.getRow(i).createCell(1).setCellValue(location);
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
+Kirti Pandit yes why not we can pass string as parameter. Not only this you can parameter path of excel, sheet name and so on.
@kirtipandit9149
@kirtipandit9149 7 жыл бұрын
Mukesh otwani but m giving location as parameter in setcellvalue. Its showing error on setcellvalue... entire code is good apart from dis.
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
+Kirti Pandit what data type you are passing
@kirtipandit9149
@kirtipandit9149 7 жыл бұрын
Webelement location
@skdash7024
@skdash7024 7 жыл бұрын
Hii mukesh, can you please provide both read and write excel data without hard coding.I am getting Error.
@pritisaha4970
@pritisaha4970 7 жыл бұрын
Hi Mukesh, Thanks for such simple and excellent explanation. I started with learning selenium and your videos are great help. I have a query about this code.. while i write in an excel sheet with existing data there is no problem. but when I am writing in new excel after creating through apachePOI code it is giving me error - "Exception in thread "main" java.lang.NullPointerException at ExcelLibrary.WriteExcelPOI.main(WriteExcelPOI.java:22)" Could you please suggest on this. ------------------------------------------------------------------------ My code to create excel file - ------------------------------------------------------------------------ import java.io.File; import java.io.FileInputStream; import java.lang.Exception; import java.io.FileOutputStream; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import ExcelLibrary.ReadDataFromExcel; public class CreateExcelPOI { public static void main(String[] args) throws Exception { //Creating excel sheet XSSFWorkbook wrbk=new XSSFWorkbook(); FileOutputStream fout =new FileOutputStream(new File("E:/WriteDemo12.xlsx")); System.out.println("File created."); XSSFSheet sheet = wrbk.createSheet("Result"); System.out.println("Sheet created."); wrbk.write(fout); fout.close(); wrbk.close(); System.out.println("Workbook closed."); } } --------------------------------------------------------- My code to write data - -------------------------------------------------------- package ExcelLibrary; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class WriteExcelPOI { public static void main(String[] args) throws Exception { // TODO Auto-generated method stub File src=new File("E:\\WriteDemo12.xlsx"); System.out.println("File located."); FileInputStream fls=new FileInputStream(src); System.out.println("File loaded."); XSSFWorkbook wb= new XSSFWorkbook(fls); XSSFSheet datasheet = wb.getSheetAt(0); datasheet.getRow(0).createCell(2).setCellValue("23.45"); datasheet.getRow(1).createCell(2).setCellValue("56.45"); FileOutputStream fout=new FileOutputStream(src); wb.write(fout); wb.close(); System.out.println("Result written in excel"); } }
@dheerajkumar-nm6pf
@dheerajkumar-nm6pf 3 жыл бұрын
How to Create a new Excel workbook. , please show us that too
@erchandanakshi3260
@erchandanakshi3260 5 жыл бұрын
Sir while executing I am getting error message "editor doesnt contain a main type".what should I do
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
Hi Chandanakshi can you please tell me is this coming in runtime or compile time ?
@erchandanakshi3260
@erchandanakshi3260 5 жыл бұрын
@@Mukeshotwani run tym sir, after clicking on run as->java application
@phaniraja9104
@phaniraja9104 3 жыл бұрын
hi bro I am getting this Exception " Exception in thread "main" java.lang.NullPointerException" can u tell me how to fix it
@ValeriiSynenko
@ValeriiSynenko 6 жыл бұрын
But how can I use data from an Excel file? Exemplify: I store user credentials in the Excel file, and I need to type them into some login form.
@JavaCafeOfficial
@JavaCafeOfficial 8 жыл бұрын
hello Sir, Can we find the datatype of excel sheet cell in selenium? if it is possible then plz explain
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Hey Mohd cell.getCellType()
@JavaCafeOfficial
@JavaCafeOfficial 8 жыл бұрын
thanks sir........
@Venkatesh602
@Venkatesh602 5 жыл бұрын
How to update the data from jtable to excel
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
Hey Venkat what do you mean by Jtable?
@piyushjhawar7681
@piyushjhawar7681 7 жыл бұрын
Thanks a lot..
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Most welcome Piyush :) Keep learning.
@sathiyasheelans5754
@sathiyasheelans5754 7 жыл бұрын
good one
@Mukeshotwani
@Mukeshotwani 7 жыл бұрын
Thanks mate
@syedmalik3001
@syedmalik3001 8 жыл бұрын
Hi sir, Nice video I have created a method write to excel and trying to add the list of webelements through iteration but getting an error as java. lang. NullPointerException
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Hi Syed, NullPointerException is a very common exception so without code it's hard to guess. I will tell you how to fix generally always call write and close method at last
@kirantherise1
@kirantherise1 8 жыл бұрын
Excellent thanks
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Thanks Kiran :)
@arunsethi6222
@arunsethi6222 8 жыл бұрын
Hello Mukesh, I am getting error "Exception in thread "main" java.lang.NullPointerException at testproject.WriteExcelFile.main(WriteExcelFile.java:45)" Please help.
@snehalchoubal4536
@snehalchoubal4536 8 жыл бұрын
Hi Mukesh, thanks a lot. Both the tutorials are very easy to understand. I was able to read from excel successfully, but while writing to the excel, getting as exception as - Exception in thread "main" org.apache.poi.POIXMLException: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13]. Also, the excel file is getting corrupted. Please help. Thanks in advance.
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Thanks Snehal kindly make sure row exist if not then create row then create cell. If still not solved then post the code I will look into it,
@snehalchoubal4536
@snehalchoubal4536 8 жыл бұрын
Thanks Mukesh. Please note that I am able to read value from the same cell but unable to overwrite that cell. I have mailed you the code and excel file, please check.
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
+Snehal Choubal no email received.. can u send again
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
+Snehal Choubal no email received.. can u send again
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
+Snehal Choubal no email
@ramakrishnareddy2702
@ramakrishnareddy2702 5 жыл бұрын
i'm following your code but i'm getting this error "The type org.apache.poi.ss.usermodel.Workbook cannot be resolved. It is indirectly referenced from required .class files FileNotFoundException cannot be resolved to a type " how to solve it..?
@mahendra6273
@mahendra6273 6 жыл бұрын
Ok bro thank u
@satyasantasangramsingh2454
@satyasantasangramsingh2454 5 жыл бұрын
am facing some issue ...its showing null pointer Exception.
@sadhanandak2646
@sadhanandak2646 8 жыл бұрын
Hi, if i mentione variable in getrow i am getting "java.lang.NullPointerException" error.. For example sheet1.getRow(row).createCell(column).setCellValue("hello1"); i have initilize the variable but still i am getting this error....pls guide me
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
It takes index so when you passed correct row and column index then it should fix your issue.
@mohammadfarhan2629
@mohammadfarhan2629 7 жыл бұрын
sir i want to login my gmail account by extracting data from excel how to do that can u help its urgent.
@javalearner4227
@javalearner4227 6 жыл бұрын
Hi Mukesh, thanks for videos they are very helpful.. I am trying to write a simple code to write in an excel sheet, cell.. but its not working.. code is as following:: Is something is missing in code.. ? public static void writeToExcel(String sheetName1, int rowNo, int columnNo) throws IOException { File file = new File( "C:\\testData.xlsx"); FileInputStream fis = new FileInputStream(file); XSSFWorkbook excel = new XSSFWorkbook(fis); XSSFSheet sheet = excel.getSheet(sheetName1); XSSFCell cell = sheet.getRow(rowNo).createCell(columnNo); cell.setCellValue("Passed"); FileOutputStream fos = new FileOutputStream(file); excel.write(fos); System.out.println("writing done"); excel.close(); } Whats the difference b/w 1. XSSFCell cell = sheet.getRow(rowNo).createCell(columnNo); 2. XSSFCell cell = sheet.createRow(rowNo).createCell(columnNo);
@Mukeshotwani
@Mukeshotwani 6 жыл бұрын
getRow(rowNo).createCell(columnNo); will add column in existing row .createRow(rowNo).createCell(columnNo); will create new column in new row
@sunflower55694
@sunflower55694 Жыл бұрын
Tried same code But writing to second row not happening It is replacing first row value Can anyone help me out
@jeevanandhanelangovan508
@jeevanandhanelangovan508 8 жыл бұрын
Please share code for write the data for excel library function in ExcelDataConfig.java.. The above video is in single file hard code data to write in excel..
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
+Jeevanandhan Elangovan Hi Jeevan please share email I will send the code.
@jeevanandhanelangovan508
@jeevanandhanelangovan508 8 жыл бұрын
+Mukesh otwani This is my mail id "jeevanandhanelango@gmail.com"
@krishnakumarravi2058
@krishnakumarravi2058 8 жыл бұрын
Hi Mukesh, your videos are great life saver for me in learning Selenium. I am very new to Java(I learned some Oops concepts back in college 10 years ago) and Selenium. Within two weeks without support from any one except your videos, now I am into Data driven Framework successfully with scripts enabled with Excel Read feature. Thanks Much for all your helpful video tutorials. Request your help in need to write String element data to excel as per the row number that is supplied in the loop for iteration. Also, I am planning to include this Write feature as a method in the lib similar to Read.Is it possible? Highly appreciate your time and help.
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
Hi Ravi, first of all Cheers for Self learning which is the best learning. For writing I have uploaded the logic in write excel video you can implement the same logic here.
@satishsahukara4195
@satishsahukara4195 6 жыл бұрын
I am getting NullPointerException at "sheet1.getRow(row).createCell(column).setCellValue(value);". can you please help any one
@marvinborn8747
@marvinborn8747 5 жыл бұрын
The cell you are trying to address is not created yet. Keep in mind that cell A1 is row 0 and column 0.
@kalavathijeeru9605
@kalavathijeeru9605 5 жыл бұрын
how to copy one excel file contents to another excel file
@DeepakKumar2105
@DeepakKumar2105 8 жыл бұрын
i am getting the error while writing data from excel file "Exception in thread "main" org.apache.poi.POIXMLException: org.apache.poi.openxml4j.exceptions.InvalidFormatException: Package should contain a content type part [M1.13]" Please help.
@Mukeshotwani
@Mukeshotwani 8 жыл бұрын
+Deepak Kumar Hi Deepak please make sure that you are using .xlsx file only.
@DeepakKumar2105
@DeepakKumar2105 8 жыл бұрын
+Mukesh otwani I am using .xlsx file. But still i get this error.
@mallareddydasari6521
@mallareddydasari6521 8 жыл бұрын
Hi Mukesh, your videos are awsome. Thank you so much for posting them. I am trying to write a variable to excel which I got it from database. I tried all possible ways of coding. Here is my code. sheet1.getRow(0).createCell(3).setCellValue("'+amount+'"); Please suggest the syntax Thank you.
@kmritunjay123
@kmritunjay123 5 жыл бұрын
getting below exception:: Exception in thread "main" java.lang.NullPointerException at MyPackage.WriteExcelFile.main(WriteExcelFile.java:20) code: package MyPackage; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class WriteExcelFile { public static void main(String[] args) throws Exception { // TODO Auto-generated method stub File f1 = new File("D:\\MyExcel.xlsx"); FileInputStream fs = new FileInputStream(f1); XSSFWorkbook wb = new XSSFWorkbook(fs); XSSFSheet sh = wb.getSheetAt(0); sh.getRow(0).createCell(2).setCellValue("PASS"); sh.getRow(2).createCell(3).setCellValue("FAIL"); //throws above exception when i try to write in any other row FileOutputStream fos = new FileOutputStream(f1); wb.write(fos); wb.close(); } }
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
Hi Kumar, If rows doesn't exist and if you try to create cell it will fail so first createRow then createCell
@kmritunjay123
@kmritunjay123 5 жыл бұрын
Thanks 🙏🏻 it worked 😊
@Mukeshotwani
@Mukeshotwani 5 жыл бұрын
Cheers
@ANILKUMAR-qr2ny
@ANILKUMAR-qr2ny 2 жыл бұрын
Hi Mukesh, I am getting "Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.io.IOUtils.byteArray(I)" error when running the code. I have downloaded different versions of commons.io jar file, tried to remove the jar files completely and then again added them but issue is not getting resolved. I have tried common-io-2.11 jar from the apache poi site & common-io-1.3.2 jar from mvn repository. Please sugggest something. Thank you
How to read excel file in Selenium Webdriver using JExcel API
14:18
Mukesh otwani
Рет қаралды 80 М.
How to Capture Screenshot in Selenium Webdriver
26:03
Mukesh otwani
Рет қаралды 201 М.
Thank you Santa
00:13
Nadir Show
Рет қаралды 53 МЛН
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 34 МЛН
How to Read Excel File in Selenium Webdriver Using Apache POI
42:46
Mukesh otwani
Рет қаралды 611 М.
Dynamic XPath in Selenium  using Different Approaches
28:12
Mukesh otwani
Рет қаралды 300 М.
@Parameters in TestNg: How to pass parameter from testing.xml
26:39
Naveen AutomationLabs
Рет қаралды 178 М.
Complete Page Object Model (POM) using Page Factory in Selenium
31:04
Mukesh otwani
Рет қаралды 275 М.
It’s time to move on from Agile Software Development (It's not working)
11:07
Object repository in Selenium Webdriver
29:20
Mukesh otwani
Рет қаралды 87 М.
The KEY To Thinking Like a Programmer (Fix This Or Keep Struggling)
10:39
WPF MVVM Implementation
28:41
DotNetSkoool
Рет қаралды 93 М.
How to execute failed test cases in Selenium webdriver
17:09
Mukesh otwani
Рет қаралды 97 М.
How to Handle Frames in Selenium Webdriver
27:03
Mukesh otwani
Рет қаралды 114 М.