Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
HungryOctopus
Contributor II
Contributor II

Job fails because of ghost excel file - Invalid header signature

Hello together,

My job runs daily and relies on a lot of Excel files.

I get the following error: Invalid header signature; read 0x0000020007160500, expected 0xE11AB1A1E011CFD0 - Your file appears not to be a valid OLE2 document

And when I look into the files, I see it's caused by this "ghost file". If I just erase it, the job runs normally. 

HungryOctopus_2-1710404849977.png

 

It happended every two or three months, but these days, it happends daily. These files have been created manually and didn't change since, so I guess the "ghost file" (sorry I don't know the technical term :/) is created by the job itself.

Any ideas so that the problem doesn't happen anymore?

Many thanks,

Best greetings,
HungryOctopus

 

Labels (3)
1 Solution

Accepted Solutions
HungryOctopus
Contributor II
Contributor II
Author

Hey Sabrina, 
Thanks, I made some adjustments to your solution but the logic helped me!
Here the Ghost Buster components:

HungryOctopus_0-1712914969717.png

 


tFileList -> tFileProperties -> tJavaRow

In the tJavaRow, I check if the file is empty or broken with following code:

globalMap.put("FileName", row14.basename);

// First condition: Check if the file/data structure is empty
if (row14.size == 0) {
globalMap.put("isEmpty", true);
} else {
globalMap.put("isEmpty", false);
}

// Second condition: Check if the basename of the file starts with "._"
if (row14.basename.startsWith("._")) {
globalMap.put("isBroken", true);
} else {
globalMap.put("isBroken", false);
}

If a file is broken, the file will be deleted: 

((Boolean)globalMap.get("isEmpty")) || ((Boolean)globalMap.get("isBroken"))

If it is not empty or broken, the file will be read and proceed:

((Boolean)globalMap.get("isEmpty")) == false && ((Boolean)globalMap.get("isBroken")) == false

The only thing is, even if the excel is empty, the filesize is still bigger than 0, so we should use something else to check this.

Best Regards,
HungryOctopus

 

 

 

View solution in original post

2 Replies
Xiaodi_Shi
Support
Support

Hello,

Are your ghost files empty? If so, you are able to delete them via tFileDelete component. With tFileProperties you can access the file length parameter and decide to delete the empty file or not in RunIf trigger.

https://community.qlik.com/t5/Official-Support-Articles/How-to-check-if-a-file-is-empty-in-a-Job/ta-...

Here is the design:

tFileList--(iterate)-->tFileProperties--(main)-->tFlowToIterate--(OnComponentOk)--(If)-->tFileDelete

Feel free to let us know if it helps.

Best regards

Sabrina

 

HungryOctopus
Contributor II
Contributor II
Author

Hey Sabrina, 
Thanks, I made some adjustments to your solution but the logic helped me!
Here the Ghost Buster components:

HungryOctopus_0-1712914969717.png

 


tFileList -> tFileProperties -> tJavaRow

In the tJavaRow, I check if the file is empty or broken with following code:

globalMap.put("FileName", row14.basename);

// First condition: Check if the file/data structure is empty
if (row14.size == 0) {
globalMap.put("isEmpty", true);
} else {
globalMap.put("isEmpty", false);
}

// Second condition: Check if the basename of the file starts with "._"
if (row14.basename.startsWith("._")) {
globalMap.put("isBroken", true);
} else {
globalMap.put("isBroken", false);
}

If a file is broken, the file will be deleted: 

((Boolean)globalMap.get("isEmpty")) || ((Boolean)globalMap.get("isBroken"))

If it is not empty or broken, the file will be read and proceed:

((Boolean)globalMap.get("isEmpty")) == false && ((Boolean)globalMap.get("isBroken")) == false

The only thing is, even if the excel is empty, the filesize is still bigger than 0, so we should use something else to check this.

Best Regards,
HungryOctopus