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.
How to export table values into excel file ?
Hi
When I am trying to export table data using the following code I am getting error like
ERROR
Wrapped java.lang.NullPointerException...
var $data=_getText("_table(29)");
_writeFile($data,"C:/Users/lokeshk/Desktop/ab.xlsx");
Could you please guide me on this scenario ?
Thanks
Lokesh
When I am trying to export table data using the following code I am getting error like
ERROR
Wrapped java.lang.NullPointerException...
var $data=_getText("_table(29)");
_writeFile($data,"C:/Users/lokeshk/Desktop/ab.xlsx");
Could you please guide me on this scenario ?
Thanks
Lokesh
Comments
Can any reply for above issue ?
Thanks,
Lokesh.
Here is the example:
Create an excel sheet at
Item Price List
Now run the above script and check if this solves your issue.
Regards
Sumitra
I have tried with your provided code but table data is not exporting and I am not getting any error also, can you please look on this ?
Thanks,
Lokesh.
Is it possible for you to post your application URL here or point us to a sample application so that i can work on it and get back to you.
Also, Kindly make sure that you are using the accessor identified by your application and make changes in the above code accordingly.
Reagards
Sumitra
I have tested with demo test table only (ex:- http://sahi.co.in/demo/tableTest.htm).
first if it's worked the I will change according my requirements.
Thanks,
Lokesh.
The following code works for me:
The Excel sheet should contain:
item price list
Check if this solves your issue.
Regards
Sumitra
I tried again with your code still problem not resolved
Thx,
lokesh.
Could you please send us the excel sheet and the usage of script to support@sahi.co.in.
Also, send me the screen shot of the table from where you are trying to extract the contents.
Regards
Sumitra
I am having the same problem.
I want to write Pass/Fail in Result column of my excel sheet, but not able to do the same.
My Excel Sheet contains below columns. (columns are in Sheet2)
SrNo Type Enabled Disabled Result
0 div snatprofileid
0 div appfilterid
0 div webfilterid
1 div snatprofileid
1 div appfilterid
This is how, I am trying:
var $db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\\Documents and Settings\\shirish.nagar\\sahi\\userdata\\scripts\\Validations\\Validation_Book.xls;readOnly=false", "", "");
$DB_FileValue1 = $db.select("select * from [Sheet1$]");
$DB_FileValue2 = $db.select("select * from [Sheet2$]");
$db.update("INSERT INTO [Sheet2$] (Result) VALUES('Pass') WHERE Disabled='snatprofileid' AND SrNo='0'");
I have tried UPDATE statement also, but even that is not working.
Kindly help in this issue.
Please refer to the reply in the CRM.
Regards,
Theeran.
The .sah file attached with CRM reply does not describe how to insert value in a particular cell of a particular column.
Kindly provide me the workaround, which can work on Sahi OS.