I have two fairly simple questions for a spectral acquisition program I am writing. First of all, I have a boolean button inside a while loop that continually checks whether it has been pressed. If it has, the program takes one snapshot of data and saves it. I want to count and store the number of times this button has been pressed so that the first time it's pressed during program execution, the user will be given a prompt to create a new spreadsheet to save the data in. Every time afterward, the program will automatically append the data to that same spreadsheet.
Similarly, in a different part of my program, I am running a continuous spectral map with several nested for loops and would like to save all the data into one spreadsheet. Right now, the program will separate the first snapshot of data from the rest, creating two spreadsheets because I cannot tell it to append the the latter data to the user-created spreadsheet (the user might create a C:/Data3.xls, but the program will always try to append to a C:/Data1.xls, for example).