2017-06-23 98 views
1

我想要如何從數據框中追加數據以使用python實現excel單元格。我能夠爲csv文件做到這一點。 代碼以CSV附加數據: -在excel中追加數據

print(yes['we'].to_csv(r'C:/Users/Desktop/yo.txt', header=None, index=None, sep=' ', mode='a')) 
+0

的可能的複製[附加現有的Excel使用python大熊貓與新數據幀片](https://stackoverflow.com/questions/38074678/append-existing- excel-sheet-with-new-dataframe-using-python-pandas) – frankyjuang

+0

你可以這樣做在這個答案:https://stackoverflow.com/a/44596841/7414759 – stovfl

回答

0
file_location="C:/Users/Jiang/Desktop/xert.xlsx" 
wb = load_workbook(file_location) 
ws = wb.get_sheet_by_name('Sheet1') 
ws.append([result0, int(result1), int(result2)])