![](/img/trans.png)
[英]In a Excel file how to find the background color of a cell using openpyxl (Python)
[英]updating cell's value in excel file using openpyxl without over writing with python
我想更新 excel 文件中的單元格而不過度寫入。 我想將新數據插入到同一個單元格中。 以下代碼為例:舊值為“RAI”,我想添加“ANKIT”而不過度寫入。 所以單元格的值變成:“RAI”,“ANKIT”
# import openpyxl module
import openpyxl
wb = openpyxl.Workbook()
sheet = wb.active
c1 = sheet.cell(row = 1, column = 1)
c1.value = "ANKIT"
wb.save("C:\\Users\\user\\Desktop\\demo.xlsx")
嘗試這個:
c1.value = c1.value + "\n" + ANKIT"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.