def write_hyperlinks(worksheet):
 if (not worksheet.hyperlinks):
  return
 tag = Element('hyperlinks')
 for cell in worksheet.hyperlinks:
  link = cell.hyperlink
  link.ref = cell.coordinate
  rel = Relationship(type='hyperlink', targetMode='External', target=link.target)
  worksheet._rels.append(rel)
  link.id = 'rId{0}'.format(len(worksheet._rels))
  tag.append(link.to_tree())
 return tag

def write_hyperlinks ( worksheet ) : if ( not worksheet . hyperlinks ) : return tag = Element ( 'hyperlinks' ) for cell in worksheet . hyperlinks : link = cell . hyperlink link . ref = cell . coordinate rel = Relationship ( type = 'hyperlink' , targetMode = 'External' , target = link . target ) worksheet . _rels . append ( rel ) link . id = 'rId{0}' . format ( len ( worksheet . _rels ) ) tag . append ( link . to_tree ( ) ) return tag
write worksheet hyperlinks to xml .