I am opening a workbook in openpyxl
thus:
wb = load_workbook(r'seven.xlsx', data_only=True)
The name of the spreadsheet won't always be know in advance, so I need to rewrite this hardcoding to allow for a variable, while still maintaining the r
?
If my variable name is sheet, then:
wb = load_workbook(sheet, data_only=True)
will omit the r
.
And obviously I cannot do:
wb = load_workbook(r'sheet', data_only=True)
How do we achieve the prepending of r to a variable / how do we wrap a vriable within r''
?
r
is just for string literals. – Frisian