code: public static DownloadResponse exportFile(Drive drive, String fileId, String format) throws IOException {
      try (InputStream inputStream = drive.files().export(fileId, format).executeAsInputStream()) {
        return new DownloadResponse(format, IOUtils.toByteArray(inputStream));
      }
    }
docs: Exports file in requested format
  
  @param drive drive client
  @param fileId id of file to be exported
  @param format target format
  @return exported data
  @throws IOException thrown when exporting fails unexpectedly