Ask Your Question

How to save and use data from spreadsheet?

asked 2013-05-08 07:54:29 -0500

anonymous user


updated 2013-05-08 10:47:17 -0500

tmonteil gravatar image

Hello community,

to automate my calculations I would like to save results of a spreadsheet calculation as seen below to compute at display the results of further calculations with sagetex.

How could I save the data from a spreadsheet to use them with sagetex?

What for a data-structure/type would you suggest?

image description

edit retag flag offensive close merge delete


csv is pretty standard, and Python can import them pretty easily for further Sage/numpy processing, which can then be fed into SageTeX... more specifics of your current workflow would help SageTeX experts help you, of course.

kcrisman gravatar imagekcrisman ( 2013-05-08 08:05:02 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-05-08 09:58:44 -0500

tmonteil gravatar image

updated 2013-05-08 10:01:10 -0500

From your spreadsheet software, you can export your spreadsheet as a CSV file, then in Sage you can do :

sage: import csv
sage: file = '/path/to/your/file.csv'
sage: reader = csv.reader(open(file))

sage: L = []
sage: for row in reader:
....:     L.append(row)

And the contents of your spreadsheet is stored in the list L. To get the entry located at the third row of the sixth column, just type:

sage: L[2][5]
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-05-08 07:54:29 -0500

Seen: 923 times

Last updated: May 08 '13