def save_as_xls(df, alter_method = True): # Saves a datatable under Excel table using XLtable if alter_method: filename = "C:\desindexation.xls" print filename writer = ExcelWriter(str(filename)) df.to_excel(writer) writer.save() else: # XLtable utile pour la mise en couleurs, reliefs, etc. de la table, inutile sinon stxl = XLtable(df) # <========== HERE TO CHANGE OVERLAY ======> wb = xlwt.Workbook() ws = wb.add_sheet('resultatstest') erfxcel = stxl.place_table(ws) try: # I dunno more clever commands wb.save("C:\outputtest.xls") except: n = random.randint(0,100) wb.save("C:\outputtest_"+str(n)+".xls")
def save_as_xls(df, alter_method=True): # Saves a datatable under Excel table using XLtable if alter_method: filename = "C:\desindexation.xls" print filename writer = ExcelWriter(str(filename)) df.to_excel(writer) writer.save() else: # XLtable utile pour la mise en couleurs, reliefs, etc. de la table, inutile sinon stxl = XLtable(df) # <========== HERE TO CHANGE OVERLAY ======> wb = xlwt.Workbook() ws = wb.add_sheet('resultatstest') erfxcel = stxl.place_table(ws) try: # I dunno more clever commands wb.save("C:\outputtest.xls") except: n = random.randint(0, 100) wb.save("C:\outputtest_" + str(n) + ".xls")
def _save_as_xls(self, filename=None, alter_method=True): # Saves a datatable under Excel table using XLtable if filename is None: raise ("filename argument is None") if alter_method: print filename writer = ExcelWriter(str(filename)) self.dataframe.to_excel(writer) writer.save() else: # XLtable utile pour la mise en couleurs, reliefs, etc. de la table, inutile sinon stxl = XLtable(self.dataframe) # <========== HERE TO CHANGE OVERLAY ======> wb = xlwt.Workbook() ws = wb.add_sheet('resultatstest') erfxcel = stxl.place_table(ws) try: # I dunno more clever commands wb.save(filename) except: pass print "error"
def _save_as_xls(self, filename = None, alter_method = True): # Saves a datatable under Excel table using XLtable if filename is None: raise("filename argument is None") if alter_method: print filename writer = ExcelWriter(str(filename)) self.dataframe.to_excel(writer) writer.save() else: # XLtable utile pour la mise en couleurs, reliefs, etc. de la table, inutile sinon stxl = XLtable(self.dataframe) # <========== HERE TO CHANGE OVERLAY ======> wb = xlwt.Workbook() ws = wb.add_sheet('resultatstest') erfxcel = stxl.place_table(ws) try: # I dunno more clever commands wb.save(filename) except: pass print "error"