Editing IO package

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 39: Line 39:
* First open the spreadsheet file using xlsopen (for Excel or gnumeric files) or odsopen (.ods or .gnumeric).  
* First open the spreadsheet file using xlsopen (for Excel or gnumeric files) or odsopen (.ods or .gnumeric).  
'''NOTE''': the output of these functions is a file pointer handle that you should treat carefully!
'''NOTE''': the output of these functions is a file pointer handle that you should treat carefully!
* (for reading data) Read the data using raw_data = xls2oct (<fileptr> [,sheet#] [,cellrange] [,options])
* (for reading data) Read the data using raw_data = xls2oct (fileptr [,sheet#] [,cellrange] [,options])
* Next, optionally split the data in numerical, text and raw data and optionally get the limits of where these came from:
* Next, optionally split the data in numerical, text and raw data and optionally get the limits of where these came from:
[num, txt, raw, lims] = parsecell (data, <fileptr.lims>)
[num, txt, raw, lims] = parsecell (data, <fileptr.lims>)
* (for writing data) Write the data using <fileptr> = oct2xls (data, <fileptr> [,sheet#] [,cellrange] [,options])
* (for writing data) Write the data using <fileptr> = oct2xls (data, <fileptr> [,sheet#] [,cellrange] [,options])
* When you're finished, DO NOT FORGET to close the file pointer handle:
* When you're finished, DO NOT FORGET to colse the file pointer handle:
<fileptr> = xlsclose (<fileptr>)</pre>
<fileptr> = xlsclose (<fileptr>)</pre>


Line 50: Line 50:


Obviously this is much more flexible (and FASTER) than xlsread and xlswrite. In fact, Octave's io package xlsread is a mere wrapper for an xlsopen-xls2oct-parsecell-xlsclose sequence. Similarly for xlswrite, odsread, and odswrite.
Obviously this is much more flexible (and FASTER) than xlsread and xlswrite. In fact, Octave's io package xlsread is a mere wrapper for an xlsopen-xls2oct-parsecell-xlsclose sequence. Similarly for xlswrite, odsread, and odswrite.


==== .xls ~= .xlsx ====
==== .xls ~= .xlsx ====
Please note that all contributions to Octave may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Octave:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Template used on this page: