Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88835

How to include the cell's value in the Excel file name with Python?

$
0
0

The existing Excel file name is test.xlsx. Let's say the value of D3 cell is 333. (This value varies from month to month, with many files.) I'm trying to include the value of D3 cell in the file name. The result must be 'test 333.xlsx'. I made the following code. But the resulting file name is 'wb,c.value.xlsx'. It seems to have been taken only as a string. How can I make 'test 333.xlsx' in an automatic way?

from openpyxl import load_workbook
wb = load_workbook('test.xlsx')
ws = wb["sheet01"] 
c = ws['D3'] 
wb.save("wb,c.value.xlsx")

Viewing all articles
Browse latest Browse all 88835

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>