문제

I am trying to update content of a file over Drive SDK, using the PHP client. The file is saved in native Drive Spreadsheet format.

My current algorithm looks as following:

  1. Download the file using Drive SDK; I use getExportLinks() to get the spreadsheet converted and downloaded as XLSX file (mime "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")

  2. I edit the downloaded file on my server and save it in XLSX format

  3. I am trying to upload it using this code (PHP): https://developers.google.com/drive/v2/reference/files/update

Everything works correctly, only point 3 fails. No matter how I would play with options, no matter if I try upload CSV or XLSX file, no matter if I use "convert" option or not, the Google responses to me with (500) Internal Error meessage.

I've been playing with the code and googling for many hours. Finally I found that my code works properly only when I am trying to update non-native formats. I have created XLSX file on my Drive, and my code updated it without any issues. I tried the same code on native spreadsheet file, and again I got (500) Internal Error.

I found that updating meta information for native files works correctly. I can edit title, description without a problem. The code fails only when I try to update the content.

Is there any possibility to update content of native Drive spreadsheet file? Or is there some workaround to get it working? Any comment would be helpful.

Thank you for your time.

도움이 되었습니까?

해결책

Its crazy to do it like that and wont work as uploading a xlsx file will create a new file not update an existing one. Google for 'google spreadsheet api', which only works on the 'old' sheets.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top