Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: to XLS

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62386] Re: to XLS
  • From: Rolf.Mertig at gmail.com
  • Date: Wed, 23 Nov 2005 01:12:04 -0500 (EST)
  • References: <20051121114855.JTPP8508.eastrmmtao02.cox.net@[172.18.52.8]> <dluqgr$nlb$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,
just use the underlying JExcelApi (see www.andykhan.com ).
Then
ModifySheetName["mydata.xls", {"newsheetname1", "bla"}]
will do what you want.

(* ***************************************************** *)
Off[General::spell1];
ModifySheetNames[xlsfile_String,sheetnames:{__String}]:=ModifySheetNames[xlsfile,xlsfile,sheetnames];
ModifySheetNames[xlsfile_String, newxlsfile_String,
sheetnames:{__String}] := Module[{
ljc=ToExpression["JLink`LoadJavaClass"],jn =
ToExpression["JLink`JavaNew"],wb,sheets},
Needs["JLink`"]; ToExpression["JLink`InstallJava[]"];
ljc["jxl.Workbook"];
wb = Workbook`createWorkbook[FF=jn["java.io.File", newxlsfile],
Workbook`getWorkbook[jn["java.io.File", xlsfile ]]];
sheets = wb[getSheets[]];
Do[sheets[[i]][setName[sheetnames[[i]]]], {i,
Min[Length[sheets],Length[sheetnames]]}];
 wb[write[]];
wb[close[]];
newxlsfile
];
(* ********************************************************* *)

Regards,
Rolf  Mertig
GluonVision Gmbh, Berlin


  • Prev by Date: Solving an integral in the limit.
  • Next by Date: Re: NDSolve
  • Previous by thread: Re: Solving an integral in the limit.
  • Next by thread: Re: to XLS