Awesome and really Helpful video thanks a lot......
@guidingbird8 жыл бұрын
You are a Great Teacher :) Thank You So much , being new to selenium was tough until i got you :)
@Mukeshotwani8 жыл бұрын
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.
@MrAmarSindol6 жыл бұрын
Thanks Mukesh, I learned reading and writing the excel data
@srinivasraghupatruni30367 жыл бұрын
Great Trainer. Good Work Mukesh (Y)
@Mukeshotwani7 жыл бұрын
Thanks Srinivas
@reenalodhi87236 жыл бұрын
very clear explanation...........
@ronwab7 жыл бұрын
Thanks Man you are very eloquent and easy to follow. very well prepared presentation for us beginner. Keep up the good work.
@nk2k1236 жыл бұрын
Thanks for the easy explanation... Really helpful.. Appreciate your effort
@Mukeshotwani6 жыл бұрын
Thanks Mate
@itssumanmsk4 жыл бұрын
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.
@Mukeshotwani4 жыл бұрын
Sure Suman, will record new video on this too.
@ruchinkhare29907 жыл бұрын
Again Great Explanation and Tutorial :)
@Mukeshotwani7 жыл бұрын
Thanks Ruchin
@vyasarajv98417 жыл бұрын
@Mukesh - Nice explanation bro...keep up the good work. Do share more such videos. Thanks!
@omkaryallavula29397 жыл бұрын
i 'm learn more from this video..
@Mukeshotwani7 жыл бұрын
Thanks Omkar, Keep learning.
@nk2k1236 жыл бұрын
true
@dev37267 жыл бұрын
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
@Ashish15Mathew8 жыл бұрын
Appreciate ur time and work.. Great explanation..!!! Thanks
@Mukeshotwani8 жыл бұрын
+ashish mathew Thanks Ashish :) Keep visiting and check other videos as well.
@Ashish15Mathew8 жыл бұрын
Welcome Mukesh.. If possible please upload videos on Hybrid framework ,Cucumber and Protractor from the scratch.. Would be really help full
@kushanchoudhury19426 жыл бұрын
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.
@myWayIn6194 жыл бұрын
Hi! Quick question, how would you go about getting text from a box and place it in a excel sheet? Thank!
@Mukeshotwani4 жыл бұрын
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.
@myWayIn6194 жыл бұрын
@@Mukeshotwani I will try, THanks!
@rajsep17 жыл бұрын
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?
@saifk85937 жыл бұрын
thanks so much. great teacher
@Mukeshotwani7 жыл бұрын
Thanks Shafiul bhai :)
@gomathigalaxy5136 жыл бұрын
Hi Mukesh, Are we able to pass the output of one row as an input value to other row.
@Mukeshotwani6 жыл бұрын
Yes Gomathi it is up to your requirement Once you know how to read and write excel then you can play with it.
@rohitmehta38124 жыл бұрын
Hi Mukesh, how to write values from a refresh row in excel sheet?
@Mukeshotwani4 жыл бұрын
Hi Rohit please use createRow to create new row in excel.
@rohitmehta38124 жыл бұрын
@@Mukeshotwani ya, I missed, thats why was getting NullPointerException, thanks mukesh for replying, much appreciated!!
@gopikrishnan81829 жыл бұрын
Good explanation..... Can you write excel file in Selenium using jxl ?
@Mukeshotwani9 жыл бұрын
+gopi krishnan Hi Gopi, yes we can do.
@pragtigupta56758 жыл бұрын
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 ?
@Mukeshotwani8 жыл бұрын
Hi Pragti, here we go kzbin.info/www/bejne/lWi7e5ikiduFaZY
@rajinder_kaur135 жыл бұрын
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.
@pnagendra54567 жыл бұрын
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.
@Mukeshotwani7 жыл бұрын
Hi Nagendra, As per methods you have to provide sheet name or index.
@pnagendra54567 жыл бұрын
Thank you for your reply. This question asked in the interview.
@pavanigayathri47376 жыл бұрын
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.
@gilsonsouza81593 жыл бұрын
Hi, How so save the excel file using Selenium after write and add some rows?
@Mukeshotwani3 жыл бұрын
yes you can call write method after every execution.
@anandkrishan90548 жыл бұрын
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..
@Mukeshotwani8 жыл бұрын
+Anand Krishan Hi ANand you can change the getSheet index and it will return the Sheet
@creativesketchs41166 жыл бұрын
you can use iterator
@sankalpboradkar86826 жыл бұрын
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 :)
@arafatkpi8 жыл бұрын
Good explanation.....#Mukesh
@Mukeshotwani8 жыл бұрын
+Arafat Hossain Hi Arafat welcome.. Keep visiting..
@shraddhagupta34558 жыл бұрын
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?
@99708886317 жыл бұрын
Thanku Very much Mukesh :)
@harshchoubey91684 жыл бұрын
Excellent way of teaching.
@Mukeshotwani4 жыл бұрын
Thanks for liking Harsh
@magicalsurprise11516 жыл бұрын
Hi how do we write WebElement values in to excel in this way
@preetrandhawa93447 жыл бұрын
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
@kalavathijeeru96055 жыл бұрын
Hai,sir Is there video for how to copy the one excel file contents to another excel file
@veeraratna7 жыл бұрын
Thank you for your time
@Mukeshotwani7 жыл бұрын
Welcome Ratna. Don’t forget to subscribe my KZbin Channel
@chetansahu81085 жыл бұрын
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 .
@Mukeshotwani4 жыл бұрын
Hi Chetan, what issues you are getting while implementing this ?
@chetansahu81084 жыл бұрын
@@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; }
@mauryar165 жыл бұрын
Thank you Mukesh
@Mukeshotwani5 жыл бұрын
Most welcome Rajendra 😁
@parasjoshi55095 жыл бұрын
Yo mukesh, How to create an user define method for WRITE EXCEL SHEET ?
@Mukeshotwani5 жыл бұрын
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.
@parasjoshi55095 жыл бұрын
@@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 .
@ashwinilohar11695 жыл бұрын
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
@Mukeshotwani5 жыл бұрын
HI Ashwini, it means you are trying to read empty excel.
@faissrizz7 жыл бұрын
Superb!!!
@mamtamahajan6424 жыл бұрын
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.
@Mukeshotwani4 жыл бұрын
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/
@mamtamahajan6424 жыл бұрын
@@Mukeshotwani Thank You so much sir, It is really helpful
@nesrinegmati11587 жыл бұрын
please i want to write same thing in multi cell for example for E7 to E12 in same row
@Mukeshotwani7 жыл бұрын
Hi Nesrine did you get solution for this?
@nesrinegmati11587 жыл бұрын
No, I didn't :(
@pankajshrivastava9684 жыл бұрын
how to write data using column name and i need to write N number of rows
@Mukeshotwani4 жыл бұрын
What issue you are facing Pankaj while writing excel?
@pankajshrivastava9684 жыл бұрын
@@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
@pankajshrivastava9684 жыл бұрын
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; }}
@pankajshrivastava9684 жыл бұрын
I have declared one global variable named as int count =1; And in a loop I am incrementing by count + 1
@ashwiniajagekar5235 жыл бұрын
sir how to get when one type cell then type other row cell from excel to Apche poi
@Mukeshotwani5 жыл бұрын
Hi Ashwini I did not get your question. Can you explain me what is your query?
@kusalmallick2863 жыл бұрын
can u please share the code how to reuse this as u did in read excel in last video.. please im getting error
@Mukeshotwani3 жыл бұрын
Hi Kusal I have code on my blog learn-automation.com/read-and-write-excel-files-in-selenium/
@mahendra62736 жыл бұрын
I have give the data from Excel and out put in the same in the Excel format possible
@Mukeshotwani6 жыл бұрын
Yes Mahendra if you want the data in same file then you can give path of the excel which you are reading..
@mohammadmajumdar80978 жыл бұрын
Good Job
@Mukeshotwani8 жыл бұрын
+Mohammad Majumdar Thanks Majumdar
@kayathiridevik51285 жыл бұрын
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
@Mukeshotwani5 жыл бұрын
Sure I will do the same in upcoming videos
@raghurao3005 жыл бұрын
@@Mukeshotwani can u make viedo same for write excel
@rohanagarwal68564 жыл бұрын
I am running this code and getting an error of NoClassFoundException.... Can you please help me on this.
@Mukeshotwani4 жыл бұрын
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.
@kalyanijoshi68845 жыл бұрын
Hi Mukesh, My excel is getting corrupted while writing to excel. 0 kb file is created after few records are added
@Mukeshotwani5 жыл бұрын
Hi Kalyani please share your code. Make sure you call write method at last.
@aekanshgupta91384 жыл бұрын
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
@Mukeshotwani4 жыл бұрын
Hi Aekansh please debug your code because NullPointerException is very common Java exception. May be some of the variables you are not initializing.
@aekanshgupta91384 жыл бұрын
@@Mukeshotwani Thanks it worked :D
@Mukeshotwani4 жыл бұрын
🙏🙏
@lliiiBodyiiill6 жыл бұрын
how to set data from website ?? thanks
@shankarachary33096 жыл бұрын
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
@raheelahmed91214 жыл бұрын
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
@Mukeshotwani4 жыл бұрын
Hi Ahmed NullPointerException is general java exception do watch this video to fix this kzbin.info/www/bejne/qIm7lnucq8eXmtE
@kirtipandit91497 жыл бұрын
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);
@Mukeshotwani7 жыл бұрын
+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.
@kirtipandit91497 жыл бұрын
Mukesh otwani but m giving location as parameter in setcellvalue. Its showing error on setcellvalue... entire code is good apart from dis.
@Mukeshotwani7 жыл бұрын
+Kirti Pandit what data type you are passing
@kirtipandit91497 жыл бұрын
Webelement location
@skdash70247 жыл бұрын
Hii mukesh, can you please provide both read and write excel data without hard coding.I am getting Error.
@pritisaha49707 жыл бұрын
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-nm6pf3 жыл бұрын
How to Create a new Excel workbook. , please show us that too
@erchandanakshi32605 жыл бұрын
Sir while executing I am getting error message "editor doesnt contain a main type".what should I do
@Mukeshotwani5 жыл бұрын
Hi Chandanakshi can you please tell me is this coming in runtime or compile time ?
@erchandanakshi32605 жыл бұрын
@@Mukeshotwani run tym sir, after clicking on run as->java application
@phaniraja91043 жыл бұрын
hi bro I am getting this Exception " Exception in thread "main" java.lang.NullPointerException" can u tell me how to fix it
@ValeriiSynenko6 жыл бұрын
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.
@JavaCafeOfficial8 жыл бұрын
hello Sir, Can we find the datatype of excel sheet cell in selenium? if it is possible then plz explain
@Mukeshotwani8 жыл бұрын
Hey Mohd cell.getCellType()
@JavaCafeOfficial8 жыл бұрын
thanks sir........
@Venkatesh6025 жыл бұрын
How to update the data from jtable to excel
@Mukeshotwani5 жыл бұрын
Hey Venkat what do you mean by Jtable?
@piyushjhawar76817 жыл бұрын
Thanks a lot..
@Mukeshotwani7 жыл бұрын
Most welcome Piyush :) Keep learning.
@sathiyasheelans57547 жыл бұрын
good one
@Mukeshotwani7 жыл бұрын
Thanks mate
@syedmalik30018 жыл бұрын
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
@Mukeshotwani8 жыл бұрын
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
@kirantherise18 жыл бұрын
Excellent thanks
@Mukeshotwani8 жыл бұрын
Thanks Kiran :)
@arunsethi62228 жыл бұрын
Hello Mukesh, I am getting error "Exception in thread "main" java.lang.NullPointerException at testproject.WriteExcelFile.main(WriteExcelFile.java:45)" Please help.
@snehalchoubal45368 жыл бұрын
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.
@Mukeshotwani8 жыл бұрын
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,
@snehalchoubal45368 жыл бұрын
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.
@Mukeshotwani8 жыл бұрын
+Snehal Choubal no email received.. can u send again
@Mukeshotwani8 жыл бұрын
+Snehal Choubal no email received.. can u send again
@Mukeshotwani8 жыл бұрын
+Snehal Choubal no email
@ramakrishnareddy27025 жыл бұрын
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..?
@mahendra62736 жыл бұрын
Ok bro thank u
@satyasantasangramsingh24545 жыл бұрын
am facing some issue ...its showing null pointer Exception.
@sadhanandak26468 жыл бұрын
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
@Mukeshotwani8 жыл бұрын
It takes index so when you passed correct row and column index then it should fix your issue.
@mohammadfarhan26297 жыл бұрын
sir i want to login my gmail account by extracting data from excel how to do that can u help its urgent.
@javalearner42276 жыл бұрын
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);
@Mukeshotwani6 жыл бұрын
getRow(rowNo).createCell(columnNo); will add column in existing row .createRow(rowNo).createCell(columnNo); will create new column in new row
@sunflower55694 Жыл бұрын
Tried same code But writing to second row not happening It is replacing first row value Can anyone help me out
@jeevanandhanelangovan5088 жыл бұрын
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..
@Mukeshotwani8 жыл бұрын
+Jeevanandhan Elangovan Hi Jeevan please share email I will send the code.
@jeevanandhanelangovan5088 жыл бұрын
+Mukesh otwani This is my mail id "jeevanandhanelango@gmail.com"
@krishnakumarravi20588 жыл бұрын
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.
@Mukeshotwani8 жыл бұрын
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.
@satishsahukara41956 жыл бұрын
I am getting NullPointerException at "sheet1.getRow(row).createCell(column).setCellValue(value);". can you please help any one
@marvinborn87475 жыл бұрын
The cell you are trying to address is not created yet. Keep in mind that cell A1 is row 0 and column 0.
@kalavathijeeru96055 жыл бұрын
how to copy one excel file contents to another excel file
@DeepakKumar21058 жыл бұрын
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.
@Mukeshotwani8 жыл бұрын
+Deepak Kumar Hi Deepak please make sure that you are using .xlsx file only.
@DeepakKumar21058 жыл бұрын
+Mukesh otwani I am using .xlsx file. But still i get this error.
@mallareddydasari65218 жыл бұрын
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.
@kmritunjay1235 жыл бұрын
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(); } }
@Mukeshotwani5 жыл бұрын
Hi Kumar, If rows doesn't exist and if you try to create cell it will fail so first createRow then createCell
@kmritunjay1235 жыл бұрын
Thanks 🙏🏻 it worked 😊
@Mukeshotwani5 жыл бұрын
Cheers
@ANILKUMAR-qr2ny2 жыл бұрын
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