rubygems - How to extract hyperlink address from excel cell using spreadsheet gem in ruby? -
i have tried retrieving data excel sheet cells. retrieve general text each cell. couldn't hyperlink address cell. used spreadsheet gem ruby. have used below code read excel sheet.
book = spreadsheet.open('c:\downloads\callstreetdata.xls') sheet1 = book.worksheet(0) rowarray = array.new sheet1.each |row| puts row.join(',') rowarray.push(row.join(',').href) end puts rowarray
i need solution ruby , spreadsheet gem
here work print out both text , links:
book = spreadsheet.open('c:\downloads\callstreetdata.xls') sheet = book.worksheet(0) sheet.rows.each |row| row_text = row.join(",") row_links = row.to_a.map |cell| cell.respond_to?(:href) ? cell.href : "" end.join(",") puts(row_text) puts(row_links) end
Comments
Post a Comment