If you really have to deal with driving a scenario with examples from a CSV or Excel here is the way to do it.
Name your examples, ideally with a name the business understands.
Write a single scenario that uses that name - do not use a Scenario Outline
Get a step to do all the work to get the Excel and examples, using the name to guide the step to get the correct examples.
Lets go through this with a simple list of the football teams in the English Premier League, and assume that you have to get these dynamically from an Excel spreadsheet
Scenario: Commpile statistics for premier league teams
Given I am working with the premier league
When I compile teams statistics
Then I should see team statistics
And there should be no errors
To make this work we have to push all the details down from the scenarios to the step definitions and ideally helper methods for those step definitions. So we end up with something like
Given "I am working with the premier league" do
@teams = load_premier_league_teams
end
and then a helper method
def load_premier_league_teams
get_the_teams_from_the_spreadsheet
end
Now all the stuff about dealing with the spreadsheet is dealt with outside of Cucumber and in your programming language.
Then in the When step you can do your operation for each of the teams as follows
When "I compile the teams statistics" do
@results = compile_statistics(@teams)
end
and write another helper method
def compile_statistics(teams)
results = []
teams.each do |t|
results << compile_team_stats(t)
...
end
Again we push all the details of how we do things DOWN out of Cucumber.
You can do the same thing for the 'There should be no errors' step, iterating through the results using the @results variable and collecting any errors.
Cucumber is just not a tool to be doing programming. With this technique you can still use it to run anything you want, whilst keeping your scenario simple and very speedy.