I am trying to download a file from the drive using google drive api
Steps to reproduce : Step 1: Click on :https://developers.google.com/drive/v3/reference/files/export#try-it Step 2: I have provided fileid and mimetype I gave fileid and mime type as "application/vnd.google-apps.spreadsheet" and click on execute.i got this error: "code":403, "message":"Export requires alt=media to download the exported content."
public static void downloadFile(Drive service,String fileId) throws IOException{
OutputStream outputStream = new ByteArrayOutputStream();
//OutputStream outputStream = new FileOutputStream("/Users/xxxxx/Downloads/driveFile.xls");
//service.get
service.files().export(fileId,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
.executeMediaAndDownloadTo(outputStream);
}