Ask a Question

Returning values from Excel File

Frequent Contributor

Returning values from Excel File



I am new to TC and trying to access/retrieve different cell values through DDT object.

I have the below code, but the result is empty. My Excel structure is : First column has heading username and second column has heading password, rows have data for both columns



function DDTReadExcel()
var lines = [];

var data = DDT.ExcelDriver(file, sheet); //file and sheet are getting values from UNIT A
var line = {};
for(var i = 0; i < data.ColumnCount; i++)
var colName = data.ColumnName(i);
line[colName] = data.Value(colName);
return lines;




function abc ()

var people = DDTReadExcel();

Community Hero

I think if you start with the first example listed here, it will be easier for you:

"The following code creates a DDT driver for an Excel sheet, runs through records of the driver’s table and posts values stored in record fields to the test log."



Some of your code is duplicating what the DDT driver does for you automatically.  Try it and let us know if you get stuck. 

[Community Hero]
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
Frequent Contributor

I can get the column values in the message log, but I cannot get a specific value from a cell. For Example, I need to store (Col1,Row1) value in a variable to use further. 

Hello @TestQA1 


I would suggest taking a look at our excel methods they are very easy to work with for pulling Excel data :


Let me know if you have any questions. 



SmartBear Alumni (Retired)

Thanks Community!


Hi @TestQA1! Does the recent advice in this thread help?

Sonya Mihaljova
Community and Education Specialist

Showing results for 
Search instead for 
Did you mean: