lib/excelfile/workbook.rb in rubyfromexcel-0.0.4 vs lib/excelfile/workbook.rb in rubyfromexcel-0.0.5

- old
+ new

@@ -42,10 +42,15 @@ end def work_out_named_references_from(xml) xml.css('definedName').each do |defined_name_xml| reference_name = defined_name_xml['name'].gsub(/([a-z])([A-Z])/,'\1_\2').downcase.gsub(/[^a-z0-9_]/,'_') - reference = Formula.parse(defined_name_xml.content).visit(FormulaBuilder.new) + reference_value = defined_name_xml.content + if reference_value.start_with?('[') + puts "Sorry, #{reference_name} (#{reference_value}) has a link to an external workbook. Skipping." + next + end + reference = Formula.parse(reference_value).visit(FormulaBuilder.new) if defined_name_xml["localSheetId"] worksheet_array[defined_name_xml["localSheetId"].to_i].named_references[reference_name] = reference else named_references[reference_name] = reference end \ No newline at end of file