Group Abstract Group Abstract

Message Boards Message Boards

0
|
22.8K Views
|
7 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Upload xl sheet via webform in cloud

Posted 12 years ago
7 Replies

Hoi Pieter, Not a perfect solution, but it is possible to upload an Excel file as binary and then you can import it after first converting the binary to xlsx, like so:

CloudDeploy@
     FormFunction[{"data" -> "Binary"}, (CloudPut[#data, "excelFile"]; 
        "Uploaded XLSX") &]

Composition[ImportString[#, "XLSX"] &,
                           ExportString[#, "Binary"] &,
                           CloudGet
  ]@"excelFile"

Rolf

POSTED BY: Rolf Mertig

Hello Emerson,
Your first function using CSV files does work and uploads as a list object in the cloud. For some strange reason I can't get the XLSX upload FormFunction to work. After submitting, the file name is removed and an error "upload a file of type XLSX" message appears in red. What could be the cause of this?
My main goal is to upload a xlsx file as is. No translation to list object. Is that easier? kind regards, Pieter

Emerson, thanks for checking this. Will do some tests myself and provide feedback.

Import of XLSX now works.

form9=FormFunction[{"data"->"XLSX"},(CloudPut[#data,"myfile9"];"Completed")&]
CloudDeploy[form9]
POSTED BY: Emerson Willard

Thanks Emerson for your ideas. I am still looking for a way to upload XLS files via a webform. Does anyone have Ideas on how to upload a file via a webform.

Spend a day trying things like this:

CloudDeploy @
 FormFunction[
  "fname" -> "String", 
  Module[{st1, st2},
    st1 = "E:\\math9\\Personal Lessons\\" <> #fname <> ".xls";
    st2 = #fname <> ".xls";
    {st1, st2, CopyFile[st1, CloudObject[st2]]}
    ] &
  ]

CopyFile seems to work only from the desktop and not on a webform.

I also tried

CloudDeploy @
 FormFunction[
  "fname" -> Interpreter[Restricted["UploadedFile", "XLS"]],
  {#fname}
  ]

but it looks this does not work because it always produces the following error: error after submitting the file with correct extension

The function isn't even evaluated and I assure you the file submitted had the right type.

can anybody help on how to do this or state that it is not yet possible in the WolframCloud?

kind regards, Pieter van Bijnen

The following works for CSV files.

enter image description here

enter image description here

However, FormFuction failed when "XLS" or "XLSX" were used.

POSTED BY: Emerson Willard
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard