Tuesday, 2 February 2016

FILLO API IN SELENIUM

FILLO API:
FILLO SELENIUM:

Fillo is an Excel API for Java and you can query xls & xlsx files.
It supports DDL , DML AND DCL commands over SQL.

1.FILLO SELECT
SELECT SQL:
===========

Syntax:
SELECT column1, column2, columnN FROM table_name;



USING SELECT:
=============
public class Filo_Select {
public static void main(String[] args) throws InterruptedException {

 Fillo fillo=new Fillo();
 Connection connection=fillo.getConnection("C:\\RAMESH\\TestdATA.xlsx");
 String strQuery="Select * from Sheet1 where name='Ramesh'";
 Recordset recordset=connection.executeQuery(strQuery);

  while(recordset.next()){
  System.out.println(recordset.getField("Details"));
 }

  recordset.close();
 connection.close();
}

}

2.FILLO UPDATE:
================

Fillo is an Excel API for Java and you can query xls & xlsx files

It supports DDL,DML AND DCL COMMANDS


public class Filo_Update
{
public static void main(String[] args) throws InterruptedException
{

 Fillo fillo=new Fillo();
 Connection connection=fillo.getConnection("C:\\Ramesh\\TestData.xlsx");
 String strQuery="Update Sheet1 Set Course='selenium' where name='Ramesh'";

 connection.executeUpdate(strQuery);

 connection.close();
}
}


3.INSERT FILLO:
=================

INSERT IN SQL:
=============
SYNTAX:
========
INSERT INTO TABLE_NAME (column1, column2, column3,...columnN)]
VALUES (value1, value2, value3,...valueN);

Here, column1, column2,...columnN are the names of the columns in the table into which you want to insert data.


//EXAMPLE INSERT COMMAND

public class Filo_Update
{
public static void main(String[] args) throws InterruptedException
{

 Fillo fillo=new Fillo();
 Connection connection=fillo.getConnection("C:\\Ramesh\\Test.xlsx");
 String strQuery="INSERT INTO Sheet1(Name,Course) VALUES('RAMESH','SELENIUM WITH JAVA')";

 connection.executeUpdate(strQuery);

 connection.close();
}
}


4.FILLO::MULTIPLE WHERE CONDITION IN FILLO:
===============================================
FILLO::MULTIPLE WHERE CONDITION IN FILLO:
========================================
Syntax:
=====
Recordset recordset=connection.executeQuery("Select * from Sheet1 where column1=value1 and column2=value2 and column3=value3 and column4=value4");


//Example

public class Filo_Update
{
public static void main(String[] args) throws InterruptedException
{

 Fillo fillo=new Fillo();
 Connection connection=fillo.getConnection("C:\\Ramesh\\Test.xlsx");
 String strQuery="INSERT INTO Sheet1(Name,Course) VALUES('RAMESH','SELENIUM WITH JAVA')";

 //with multiple where conditions
 Recordset recordset=connection.executeQuery("Select * from Sheet1 where column1=value1 and column2=value2 and column3=value3");

 Recordset recordset=connection.executeQuery("Select * from Sheet1 where Name=Ramesh and Course=SELENIUM WITH JAVA and ID=3");

 connection.close();


5.FILLO:WHERE METHOD:
======================
FILLO:WHERE METHOD:
=====================

Syntax:
======
Recordset recordset=connection.executeQuery("Select * from Sheet1").where("COLUMN=VALUE").where("COLUMN=VALUE'");


//Example on where method in fillo

public class Filo_Where
{
public static void main(String[] args) throws InterruptedException
{



 Fillo fillo=new Fillo();
 Connection connection=fillo.getConnection("C:\\Ramesh\\Test.xlsx");


 //with  where method
 Recordset recordset=connection.executeQuery("Select * from Sheet1").where("Name=Ramesh").where("Course='Selenium'");

 connection.close();
}
}




6.FILLO Set table starting row and column:
==========================

Syntax:
========

//Table start row
System.setProperty("ROW", "rownumber");

////Table start column
System.setProperty("COLUMN", "columnnumber");


//Example on Set table starting row and column

public class StTableDemo {
 public static void main(String[] args) throws InterruptedException {

  // Now set table start row and column

  // Table start row
  System.setProperty("ROW", "1");

  // Table start column
  System.setProperty("COLUMN", "4");

  Fillo fillo = new Fillo();
  Connection connection = fillo.getConnection("C:\\Ramesh\\Test.xlsx");

  // with where method
  Recordset recordset = connection.executeQuery("Select * from Sheet1")
    .where("Name=Ramesh").where("Course='Selenium'");

  connection.close();

 }
}


FILLO SELENIUM WEBDRIVER NEW CONCEPTS

1 comment:

  1. How can you create a new sheet and an new table using this api ?

    ReplyDelete