Read Excel in created helper object

Hi together

I’m new in using eggplant but with know how of using OOP.

I’ve reading the part of ‘Objects Designed to be Helpers’ of the eggplant documentation and want to create an helper that will handle my excel for advanced test sequences.

I tried to open the excel file in the created object but I got an error message, when I open the worksheet.
error: “Workbook Error - Wrong file type (must be ‘xls’ or ‘xlsx’ file): /Users/myUser/Workplace/{/}”

On the code line "set wsValues to Worksheet(excelWorkbook,1) " raise the error.

When I execute the Script Main_Second (see below) then I get no error, it just works. I cannot understand why the same code not works, if it is in a created helper ??

Can here somebody help?

here my code lines:

Script Main:

put new "Helpers/helperTestSequence" into testSequence
put testSequence.getStepList() into stepList

Script helperTestSequence

to getStepList
	try
		set excelWorkbook to Workbook(ResourcePath("Messages/Test_1.xlsx"))
		set wsValues to Worksheet(excelWorkbook,1)         // here will raise the error.
		// here read the excel content into a indexed list...
	catch excOpenFile
		throw excOpenFile
	end try
	// return the indexed list...
	return ixList
End getStepList

Script Main_Second:

put "Helpers/helperTestSequence".getStepList() into stepList

Please send problems like this to the support address. The forums are not intended for support issues.

When I have experienced similar issues, it was because of the ‘/’ inside the quotes (e.g. “Messages/Test_1.xlsx” Try moving the Excel to the Resources root folder and drop “Messages/” If it works then, ,you are on your way to troubleshooting the issue.

Hi
Sorry I didn’t know this is an issue. I thought I do something wrong.
Cheers

Hi, thanks for your answer. But didn’t help. So it will be an issue and I will contact the eggplant support as EggplantMatt did suppose.
Cheers.

@ChiefJoseph Hello, I am currently facing this issue can you tell me how you where able to solve this error.

@Priscilla92 The code below works for me in v 21.3.1

set excelWorkbook to Workbook(ResourcePath("DataFiles/data_REG-1.xlsx"))
log excelworkbook
set wsvalues to worksheet(excelWorkbook,1)
log wsvalues

If you would like to post a portion of the code, the community might be able to determine where the issue is occurring.
Thanks,
Dave