How to write excel file in Selenium using Apache POI

How to write excel file in Selenium using Apache POI

Mukesh otwani

8 лет назад

143,742 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Anjana S
Anjana S - 24.02.2023 17:31

Tried same code
But writing to second row not happening
It is replacing first row value
Can anyone help me out

Ответить
Sangeetha's Creation
Sangeetha's Creation - 20.05.2022 02:45

Very clear explanation. Thankyou

Ответить
Sanket D
Sanket D - 12.04.2022 13:57

Finally, a good video to understand the concept. went through all the links and videos but clearly the best video.

Ответить
Phani Raja
Phani Raja - 10.10.2021 13:29

hi bro I am getting this Exception " Exception in thread "main" java.lang.NullPointerException" can u tell me how to fix it

Ответить
dheeraj kumar
dheeraj kumar - 13.06.2021 16:32

How to Create a new Excel workbook. , please show us that too

Ответить
Devendra Pawar
Devendra Pawar - 18.05.2021 19:57

Exactly I was looking for 🤗

Ответить
Gilson Souza
Gilson Souza - 12.05.2021 23:52

Hi, How so save the excel file using Selenium after write and add some rows?

Ответить
Nirmal Rawtani
Nirmal Rawtani - 24.04.2021 13:30

Very helpful. Thanks Mukesh :)

Ответить
Kusal Mallick
Kusal Mallick - 02.03.2021 17:29

package readexceldata;

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;

public class WriteExcel2
{
File src;
XSSFWorkbook wb;
XSSFSheet sheet1;
public WriteExcel2()
{

try {
src = new File("C:\\eclipse-workspace\\TestData.xlsx");
FileInputStream fis= new FileInputStream(src);
wb = new XSSFWorkbook(fis);
} catch (Exception e) {

System.out.println(e.getMessage());
}
}

public String getData(int sheetnumber,int row,int column)
{
FileOutputStream fout=new FileOutputStream(src);
sheet1=wb.getSheetAt(sheetnumber);
<34> String data= sheet1.getRow(0).createCell(2).setCellValue("pass");
return data;
}

}
In this 34 line im getting this error"Type mismatch: cannot convert from void to String"..what to do sir

Ответить
Kusal Mallick
Kusal Mallick - 02.03.2021 16:40

can u please share the code how to reuse this as u did in read excel in last video.. please im getting error

Ответить
Raheel ahmed
Raheel ahmed - 07.12.2020 11:22

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

Ответить
SumanKumar Madham
SumanKumar Madham - 03.12.2020 15:09

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.

Ответить
Aekansh Gupta
Aekansh Gupta - 11.09.2020 15:45

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

Ответить
Shiva Prasad
Shiva Prasad - 20.08.2020 15:27

Thank you so much, Mukesh...You saved my day..

Ответить
Mamta Mahajan
Mamta Mahajan - 20.07.2020 16:34

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.

Ответить
Pankaj Shrivastava
Pankaj Shrivastava - 14.06.2020 12:09

how to write data using column name and i need to write N number of rows

Ответить
Harsh Choubey
Harsh Choubey - 05.06.2020 15:59

Excellent way of teaching.

Ответить
ROHIT
ROHIT - 07.05.2020 12:20

Hi Mukesh, how to write values from a refresh row in excel sheet?

Ответить
rohan agarwal
rohan agarwal - 03.05.2020 20:09

I am running this code and getting an error of NoClassFoundException.... Can you please help me on this.

Ответить