Extract data from python to excel
Hello, I need to solve a problem. I am trying to extract xml data using elementTree, and the value is showing in the console, but I can't write to Excel as I want. So I use the Xlwings library but the error is that I need to write a value in a cell and then write another value, however the code repeats the same value and saves the Excel over and over until all the values (in the range that I specify) ââcoming out of console they finish reading. def ExtraerPXConciliar(): with open('./Autofactura1.xml', 'rt') as f: tree = ElementTree.parse(f) #root = tree.getroot() #print(root) for node in tree.iter('GeneralData'): name = node.attrib.get('Ref') if name != None: print(' %s' % name) #Extraemos el PX #Exportamos a EXCEL wb = xw.Book('./Hoja.xlsx') #Workbook location sht = wb.sheets['Hoja1'] #Sheet Name sht.range('A1:A5').value = name wb.save()