How to name ACCC excel results
I see that previously a question was asked about how to automate the export of ACCC results to excel. I can manage the export part.
What I can't figure out is how to name the output excel file via a GUI that shows the directory the file is to be saved in (this is useful as a memory prompt for previously used naming conventions etc).
I've tried using
import tkFileDialog filename = tkFileDialog.askopenfilename()
and
import tkFileDialog filename = tkFileDialog.asksaveasfilename()
In various different ways without success. Any ideas?
OK so I've largely figured this out myself.
Arrgh! I want to add a space and it keeps posting! Anyway I've largely figured this out myself. If someone can tell me how to paste code such that it looks readable and isn't jumbled in as normal txt I'll put it up. There is a bug though which I will also explain.
For an inline code snippet, you can surround the code in backticks ( ` ). For a code block, the code needs to be indented from the normal text. You can also use the "101..." button in the editor toolbar to do this for you. Nice work btw.
Hi there! We would love to see the code.
import tkFileDialog, ntpath filetypes = [('Excel Workbook', '*.xlsx'),('All Files','*.*')] filenamesaveas = tkFileDialog.asksaveasfilename(filetypes=filetypes, title='Results Workbook Name') xlsfilename = ntpath.basename(filenamesaveas)