You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

secure-spreadsheet

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

secure-spreadsheet

Secure your data exports - encrypt and password protect sensitive CSV and XLSX files

0.2.1
latest
Source
npmnpm
Version published
Weekly downloads
4.5K
10.28%
Maintainers
1
Weekly downloads
 
Created
Source

Secure Spreadsheet

:fire: Secure your data exports - encrypt and password protect sensitive CSV and XLSX files

The Office Open XML format provides a standard for encryption and password protection

Works with Excel, Numbers, and LibreOffice Calc

Build Status

Getting Started

Install the CLI

npm install -g secure-spreadsheet

Convert a CSV into password-protected, AES-256 encrypted XLSX

secure-spreadsheet --password secret < input.csv > output.xlsx

Protect an existing XLSX

secure-spreadsheet --password secret --input-format xlsx < input.xlsx > output.xlsx

Languages

You can use the CLI to create encrypted spreadsheets in other languages.

  • PHP
  • Python
  • Ruby

Pull requests are welcome for more languages.

PHP

<?php

$csv_str = "awesome,csv";

$descriptorspec = array(
  0 => array("pipe", "r"),
  1 => array("pipe", "w")
);

$process = proc_open(["secure-spreadsheet", "--password", "secret"], $descriptorspec, $pipes);

if (!is_resource($process)) {
  die("Command failed");
}

fwrite($pipes[0], $csv_str);
fclose($pipes[0]);

$result = stream_get_contents($pipes[1]);
fclose($pipes[1]);

if (proc_close($process) != 0) {
  die("Command failed");
}

file_put_contents("output.xlsx", $result);

Python

import subprocess

csv_str = b'awesome,csv'

result = subprocess.check_output(['secure-spreadsheet', '--password', 'secret'], input=csv_str)

with open('output.xlsx', 'wb') as f:
    f.write(result)

Ruby

require "open3"

csv_str = "awesome,csv"

result, status = Open3.capture2("secure-spreadsheet", "--password", "secret", stdin_data: csv_str)
raise "Command failed" unless status.success?

File.write("output.xlsx", result)

Other Approaches

An alternative approach to secure your data is to create a password-protected ZIP archive. However, this leaves the data exposed after it’s unzipped.

Notes

The content type for XLSX is application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.

Credits

Thanks to xlsx-populate for providing the encryption and password protection.

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/ankane/secure-spreadsheet.git
cd secure-spreadsheet
npm install

FAQs

Package last updated on 08 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.