I am new to python and looking to make a program that looks through a given folder, looks at each workbook and pulls a specific cell, and uses that cell as the name of a new workbook being created. I can pull the name pretty easily and store it, however I cannot figure out how to use this with the xlsxwriter function to save the new workbook. Is there any way to specify both the location and file name using xlsxwriter?
for files in filenames:
oldWorkBook = openpyxl.load_workbook(files)
lotWorkSheet = oldWorkBook['Order Entry']
newFileName = lotWorkSheet.cell(row = 8, column = 14)
workbook = xlsxwriter.Workbook(r"C:\Users\sf\Documents\Test Files\")
worksheet = workbook.add_worksheet('data')
worksheet.write('A1', 'Hello..')
workbook.close()
The first part works and newFileName is successfully housing the name of the worksheet I want to use. However, I can't figure out how to successfully name the workbook based on the variable.
Any help is much appreciated!
