On 2018-07-03 10:51 AM, turbofib wrote:
> Name file Excel : "prova:xls"
> Name sheet in this file : "workgroup"
> i don't want to delete "prova.xls" but i want to delete "workgroup"
Got it. Sorry that goes well beyond my comfort level with the octave-io
package, hopefully someone else has an idea.
> i use xlswrite(namefile…) to rewrite in the Excel file
> but i don't know if it's possible to delete the old sheet in this file..
Why do you need this in the first place?
You can simply overwrite data in existing worksheets. If existing data are
in the way it may well be (I'm not sure) that writing a big enough numeric
array of NaNs will wipe existing spreadsheet data in the written-to cell
Anyway, removing a worksheet is certainly possible but you need to dive into
the relevant Javadocs for each Java-based interface and/or into Visual Basic
for the COM interface (when using the windows package and Excel).
For the latter case have a look at private/__COM_oct2spsh__.m, lines
182-186, in the io package.
For the Java-based interfaces you have to dive in the docs for Apache POI,
JOD, etc. yourself.
> it's correct...
> the problem is the new dimension matrix is different
> But is more larger o smaller?
> I should record on file the size of the old matrix
Using the function xlsfinfo() on the spreadsheet file you get the dimensions
of the rectangle containing all data cells for each worksheet (note: Matlab
doesn't do this, Octave's xlsfinfo is a bit better in this respect).
So you can use xlsfinfo's output to create a large enough NaN array to wipe
all data in a certain sheet. (I just tried and writing NaNs will indeed
erase data in the referenced spreadsheet cells).
Or write a NaN array tojust the cll ranges you want to be wiped.
Or you can make an array (or cell array) with new data and augment it with
NaN cells to wipe data you don't want to retain.
So, lots and lots of ways to do it.
Just experiment a bit ....