18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Not able to do "Insert into" in excel file.
I am trying to Insert records into My excel file. Not able to figure it out. It would be great if someone can help me out.
Thanking in advance
-Pranav
CODE :
var dba = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\\CheckNames.xls;readOnly=false", "", "");
var $selectCount;
var $categories;
_set($selectCount, _byClassName("searchBarComponentOptions", "select").length);
for (var $k=1; $k<$selectCount; $k++){
_set($categories, _getText(_select(0).options[$k]));
_setSelected(_select(0), $categories);
_click(_div("Search >"));
if (_condition(_exists(_select("viewItemsPerPage"), "View All"))) {
_setSelected(_select("viewItemsPerPage"), "View All");
_setSelected(_select("searchSort"), "Price: Low to High");
}
for (var $i=0; $i<100; $i++){
var $el = _div("itemGridTitle[" + $i + "]");
if (_condition(!_exists($el))){
break;
}
var $Temp;
_set($Temp, _getText($el));
$Temp1 = $Temp.replace(//g, "~");
_alert("insert into [Sheet1$] (RowNumber, CatCode, ItemName, category, Exists) values ('"+ $i + "', '" + $k + "', '" + $Temp1 + "', '" + $categories + "', 'T')");
dba.update("insert into [Sheet1$] (RowNumber, CatCode, ItemName, category, Exists) values ('"+ $i + "', '" + $k + "', '" + $Temp1 + "', '" + $categories + "', 'T')");
}
---- more code to follow
I have the following Rows in my excel ( CheckNames.xls)
RowNumber CatCode ItemName category Exists Denomination Price ActualItemName
Thanking in advance
-Pranav
CODE :
var dba = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\\CheckNames.xls;readOnly=false", "", "");
var $selectCount;
var $categories;
_set($selectCount, _byClassName("searchBarComponentOptions", "select").length);
for (var $k=1; $k<$selectCount; $k++){
_set($categories, _getText(_select(0).options[$k]));
_setSelected(_select(0), $categories);
_click(_div("Search >"));
if (_condition(_exists(_select("viewItemsPerPage"), "View All"))) {
_setSelected(_select("viewItemsPerPage"), "View All");
_setSelected(_select("searchSort"), "Price: Low to High");
}
for (var $i=0; $i<100; $i++){
var $el = _div("itemGridTitle[" + $i + "]");
if (_condition(!_exists($el))){
break;
}
var $Temp;
_set($Temp, _getText($el));
$Temp1 = $Temp.replace(//g, "~");
_alert("insert into [Sheet1$] (RowNumber, CatCode, ItemName, category, Exists) values ('"+ $i + "', '" + $k + "', '" + $Temp1 + "', '" + $categories + "', 'T')");
dba.update("insert into [Sheet1$] (RowNumber, CatCode, ItemName, category, Exists) values ('"+ $i + "', '" + $k + "', '" + $Temp1 + "', '" + $categories + "', 'T')");
}
---- more code to follow
I have the following Rows in my excel ( CheckNames.xls)
RowNumber CatCode ItemName category Exists Denomination Price ActualItemName