On 22/08/12 21:51, Cecilia Chavana-Bryant wrote:

def main(fname, sheet_name):
     wb = xlrd.open_workbook(fname)
     sh = wb.sheet_by_name(sheet_name)
     data1 = sh.col_values(0)
     data2 = sh.col_values(1)

     return data1, data2

fname = "Cal_File_P17.xlsx"
sheet_name = "RefPanelData"
(data1, data2) = main(fname)

print data1, data2

... I do not know where the data is being saved to.


That's because it isn't being saved anywhere, it gets
thrown away after printing it.

If you want to save it you need to augment/replace the print
statement with a file write statement(s)

You could also write it out using the OS redirection facility.
On Unix (ie Your MacOS Terminal) thats done by running the
program like:

$ python myprog.py > myOutputFile.txt

Where you substitute your own desired program name and
output filename of course!

But that will just create a text file that looks like the output displayed on the Terminal, which is not, I think, what you are after.
You probably want to do some extra work to save as a csv file.

However, before you do that you could look at using the spreadsheet's SaveAs feature to export as a CSV directly, but it depends on how many spreadsheets you need to convert!

HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to