I got these 3 errors on my code :
private static void downloadFile(Drive service, String fileId) {
try {
OutputStream outputStream = new FileOutputStream("test.csv");
service.files().export(fileId, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet").executeMediaAndDownloadTo(outputStream);
} catch (IOException e) {
// An error occurred.
e.printStackTrace();
}
}
here's the error results :
Exception in thread "main" java.lang.NullPointerException at googleBaru.mainClass.downloadFile(mainClass.java:51) at googleBaru.mainClass.main(mainClass.java:60)
I hope anyone can fix my code, or how am I suppose to do to calling the method (with parameter service and fileId)
many thanks, sorry for my bad English