Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obtain the "absolute path to the workbook" from an .xls file

When I use the Excel "Document Inspector" on a particular .xls file to check for "hidden properties or personal information" it says:

The following document information was found:
* Absolute path to the workbook

How can I obtain the absolute path of the workbook from the file? If it needs to be done programmatically, I could use Java (e.g. Apache POI) or VBA.

I know where the file is currently saved, but what I want to extract is the absolute path to the workbook which is saved in the file I have. This is so I can know where it was saved by the author.

Here's what has happened to the file:

  1. Someone authored it, saving it at some absolute filepath unknown to me
  2. They uploaded it to a website
  3. I downloaded it from the website

Excel indicates that the document contains the absolute path from step 1. I'm after this path, not the place I saved it at step 3 since I know that.

like image 224
WW. Avatar asked Dec 13 '16 23:12

WW.


People also ask

What is absolute path to the workbook?

An absolute path defines the absolute location of the file within the file system. It is commonly used for resources that serve as data sources for the model (for example, text or Excel files) and are stored outside of the model folder (for example, on a file server or in a shared folder).

How do I insert the file path in an Excel spreadsheet?

Click Quick Access Toolbar option; Then choose All Commands from the Choose commands from drop down list; And select Document Location, then click Add > > button, the Document Location has been added to the right pane.

How do I remove absolute path in Excel?

To prevent Excel from changing hyperlinks from absolute to relative, go to File - Info, click Show all properties and fill Hyperlink base property with c:\ .


1 Answers

I can reproduced that warning message by simply creating an empty Excel file, added a formula, saved it as BIFF8 (.xls). The Document Inspector will then warn about the absolute path. ... but in my case, there was no filename inside the file.

A simple way to verify this, is to open the file in a hex-editor and search for a well-known save location (i.e. the location where a dummy/test file was stored) - this is either stored as ASCII or as 16-bit string, i.e. every odd byte is a character.

If you want to use the POI developer tools, you can use the following:

To list all Excel records:
java -cp poi-3.16-beta1.jar org.apache.poi.hssf.dev.BiffViewer file.xls

To list the document and summary properties:
java -cp poi-3.16-beta1.jar org.apache.poi.hpsf.extractor.HPSFPropertiesExtractor file.xls

To list any embedded objects beside the usual suspects SummaryInformation, DocumentSummaryInformation and Workbook:
java -cp poi-3.16-beta1.jar org.apache.poi.poifs.dev.POIFSLister file.xls

So after running the tools and recording the output, you can then remove the properties via the Excel Document Inspector and execute the tools again. The output can be diffed and you might find the culprit.

like image 199
kiwiwings Avatar answered Sep 21 '22 12:09

kiwiwings