def save(wb, filename_or_stream): "Save the supplied :class:`xlrd.Book` to the supplied stream or filename." if isinstance(filename_or_stream, basestring): filename = os.path.split(filename_or_stream)[1] stream = open(filename_or_stream, 'wb') close = True else: filename = 'unknown.xls' stream = filename_or_stream close = False process(XLRDReader(wb, filename), StreamWriter(stream)) if close: stream.close()
def save(wb,filename_or_stream): if isinstance(filename_or_stream,basestring): filename = os.path.split(filename_or_stream)[1] stream = open(filename_or_stream,'wb') close = True else: filename = 'unknown.xls' stream = filename_or_stream close = False process( XLRDReader(wb,filename), StreamWriter(stream) ) if close: stream.close()
def run(infile, outfile, filter): wb = xlrd.open_workbook(file_contents=infile.read()) reader = XLRDReader(wb, infile.name) writer = StreamWriter(outfile) process(reader, filter, Anonymize(), writer)