How to convert Excel File-Format to G-Sheet by Drive API upload?

Viewed 4266

I can upload and convert CSV files by Drive API without any problem, but when sending XLS (rendered with PEAR XLS-Writer) or XLSX (rendered with PHPExcel) the Drive API complains:

"Error calling POST https://www.googleapis.com/upload/drive/v2/files?convert=true&uploadType=multipart&key=123: (500) Internal Error"

MIME type "application/vnd.ms-excel" apparently works better than "application/vnd-excel"

When I write out XLSX with content-type "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" it's quite the same ... it gets stuck when loading the preview, when convert=true.

When creating files with MS Excel and uploading them manually it works fine.

I can insert/update, download/open the files (all fine) - but I want to convert them.

With all the tests performed I guess the problem is related to the created file-format - or MIME type.

Any hints why the conversion might fail...

"Did ever someone managed to convert rendered XLS/XLSX?"

The question basically is: What is the expected file-format + MIME-type in order to convert to gSheet?

I'd accept any answer for the bounty, which provides a way to convert a multi-dimensional array to gSheet with several pages, in case it's not (yet) possible via the Drive API (for sure that would be the preferred way).

This is a Google Drive API question - there's just no individual tag for this available.

3 Answers
Related