def write_external_link(links):
 root = Element(('{%s}externalLink' % SHEET_MAIN_NS))
 book = SubElement(root, ('{%s}externalBook' % SHEET_MAIN_NS), {('{%s}id' % REL_NS): 'rId1'})
 external_ranges = SubElement(book, ('{%s}definedNames' % SHEET_MAIN_NS))
 for l in links:
  external_ranges.append(Element(('{%s}definedName' % SHEET_MAIN_NS), dict(l)))
 return root

def write_external_link ( links ) : root = Element ( ( '{%s}externalLink' % SHEET_MAIN_NS ) ) book = SubElement ( root , ( '{%s}externalBook' % SHEET_MAIN_NS ) , { ( '{%s}id' % REL_NS ) : 'rId1' } ) external_ranges = SubElement ( book , ( '{%s}definedNames' % SHEET_MAIN_NS ) ) for l in links : external_ranges . append ( Element ( ( '{%s}definedName' % SHEET_MAIN_NS ) , dict ( l ) ) ) return root
serialise links to ranges in a single external worbook .