Processing Excel (XLS/XLSX) Files

Private AI supports scanning Microsoft Excel XLS and XLSX files for PII and creating de-identified or redacted copies. Private AI’s supported entity types function across each file type, with localized variants of different PII (Personally Identifiable Information) entities, PHI (Protected Health Information) entities, and PCI (Payment Card Industry) entities being detected. Our Supported Languages and Supported Entity Types page provides a more detailed look.

How XLSX Files Are Processed

Similar to CSV files, cell contents of XLSX files are processed using the method described for Tabular Data in the Structured Data Guide. In addition to cell contents, the following elements are handled:

Property Type Details Behaviour
Core properties Author, Category, Comments, Content Status, Identifier, Keywords, Language, Last Modified By, Subject, Title, Version Redact
Headers and footers Any content in headers and footers, such as text and images. Can appear when the document is printed Passthrough, will change to Redact in a future release
Images The Images page provides a more detailed look at Image processing Redact, unsupported image types are removed
Text boxes Floating text boxes Passthrough, will change to Remove in a future release
Embedded links Hyperlinks to internet pages or documents Remove
External elements Tables and charts embedded from another document or file, such as an Excel chart or table object Passthrough, please process these separately
Embedded audio & video Videos and audio clips Passthrough, will change to Remove in a future release
Review comments Comments from document reviews Passthrough, will change to Remove in a future release
Shape objects Shapes containing text Passthrough, will change to Redact in a future release
info

Graphical content where text is present will be OCRed and then redacted. Check out our OCR Guide to see the available OCR modes.

How XLS Files Are Processed

XLS files are processed by converting into XLSX files, followed the process described above and then converting back to XLS files.

Constraints

  • Cell contents of XLSX files are processed using the method described for Tabular Data in the Structured Data Guide . This requires the data to be column-oriented and the headers to be on the first non-empty row.
  • Shape objects will not be preserved.
  • Formulas may not be preserved after redaction.

Support Matrix

CPU Container GPU Container Demo API Prod API PrivateGPT UI
Supported? Yes Yes No Yes No

Sample Request

info

Please sign up for a free API key to run this code.

Copy
Copied
import requests
import base64

file_url = "https://paidocumentation.blob.core.windows.net/$web/sample.xlsx"
file_content = requests.get(file_url).content
file_content_base64 = base64.b64encode(file_content).decode()

url = "https://api.private-ai.com/deid/v3/process/files/base64"

headers = {"Content-Type": "application/json", "x-api-key": "<INSERT API KEY>"}

payload = {
  "file":{
    "data": file_content_base64,
    "content_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
  },
  "entity_detection": {
    "accuracy": "high",
    "return_entity": True
  }
}

response = requests.post(url, json=payload, headers=headers)

Sample Response

Copy
Copied
"processed_file": "Base64 Encoded File Content of the Redacted File",
"processed_text":"string",
"entities":"List[Entity]",
"entities_present":true,
"languages_detected":{"lang_1":0.67, "lang_2": 0.74}
© Copyright 2024 Private AI.