Message Boards Message Boards

Can the Cloud Kernel import a XL file?

Posted 10 years ago

First I copied a simple xl file webcontent.xlsx to the cloud. Then from my local kernel I imported the XL file from the cloud. This works fine.

Import[CloudObject["/webcontent.xlsx"], {"XLSX", "Sheets", "Sheet1"}]

My basic idea was to ask the cloudkernel to do the xl import and merge it with a web template into a html page. But it seems the cloudkernel is not able to read xl files. From my local desktop:

CloudEvaluate[Import["webcontent.xlsx","Elements"]]

returns:

{"Data", "FormattedData", "Formulas", "Images", "Sheets"}

This looks hopeful but the next 2 commands return $Failed. The message window shows "cannot import data as xls format".

CloudEvaluate[Import["webcontent.xlsx",{"XLSX","Sheets"}]]

CloudEvaluate[Import["webcontent.xlsx",{"XLSX", "Sheets", "Sheet1"}]]

Maybe it has something to do with the cloudservers running on Linux?

Although when I evaluate the following in a web-interface-notebook in the programming cloud it works fine!

Import["webcontent.xlsx", {"XLSX", "Sheets", "Sheet1"}]

So its not the server but something else. Is the frontend involved? It is my understanding that CloudEvaluate takes its contents to the cloud, then evaluates and returns with the results to the local kernel. Any ideas on where I missed a beat?

3 Replies

For Mathematica in a desktop machine, this ReinstallJava method is documented, in a fashion, in
http://support.wolfram.com/kb/12500 and
http://support.wolfram.com/kb/12428 .

POSTED BY: Bruce Miller

Rolf,

Thanks for the solution. It solved the issue but not without error messages:

A Java exception occurred: java.lang.ClassCastException: com.wolfram.jlink.JLinkSecurityManager cannot be cast to com.wolfram.jlink.JLinkCloudSecurityManager.

and when used in a Scheduled task in the cloud the logfile produces:

LinkObject::linkn: Argument LinkObject[g4akge2_ipq, 70, 1] in LinkWrite[LinkObject[g4akge2_ipq, 70, 1], CallPacket[CloudSystemPrivateServiceDispatch[CloudSystemUtilitiesPrivate`iFileNameToURL[ etcetera.

Maybe someone from Wolfram can recommend the "designed" way to read a xl file by cloud evaluation.

Hallo Pieter, sure it works. You just have to realize that the cloud is on Linux somewhere and probably the default settings for InstallJava are just too restrictive. This simple trick (which really Wolfram should include in their aging documentation very very soon, for the long awaited 10.0.3 update which hopefully fixes other urgent (slowdown) bugs) just works for me:

CloudEvaluate[
 JLink`ReinstallJava[JVMArguments -> "-Xmx2048m"];
 Import["test.xlsx"]
 ]
POSTED BY: Rolf Mertig
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract