Ask Your Question

How to save and use data from spreadsheet?

asked 2013-05-08 14:54:29 +0200

anonymous user


updated 2013-05-08 17:47:17 +0200

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 15:05:02 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-08 16:58:44 +0200

tmonteil gravatar image

updated 2013-05-08 17:01:10 +0200

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 14:54:29 +0200

Seen: 2,347 times

Last updated: May 08 '13