
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
aspose.cells.js
Advanced tools
Aspose.Cells for JavaScript via C++ is a high-performance, feature-rich library for manipulating and converting Excel (XLS, XLSX, XLSB), ODS, CSV, and HTML files. It provides a comprehensive set of features for creating, editing, converting, and rendering
Aspose.Cells for JavaScript via C++ is a high-performance, feature-rich library for manipulating and converting spreadsheet files, including Excel (XLS, XLSX, XLSB, XLSM), ODS, CSV, and HTML formats. It provides a comprehensive set of features for creating, editing, converting, and rendering spreadsheets in both browser and Node.js environments. With full support for all major Excel formats, Aspose.Cells for JavaScript via C++ ensures maximum compatibility and flexibility across diverse use cases.
Built with WebAssembly to unlock near-native performance directly in the browser, Aspose.Cells for JavaScript via C++ enables fast and efficient spreadsheet processing without the need for a server. Its lightweight runtime footprint makes it perfect for serverless web applications that require advanced Excel functionality. Whether you're building dashboards, data processing pipelines, or document generation tools, Aspose.Cells for JavaScript via C++ offers a complete, reliable, and high-performance solution that works seamlessly across web, server-side, and hybrid environments.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
<script src="aspose.cells.js.min.js"></script>
<script type="text/javascript">
const { Workbook, FileFormatType, SaveFormat } = AsposeCells;
AsposeCells.onReady().then(() => {
var workbook = new Workbook(FileFormatType.Xlsx);
workbook.worksheets.get(0).cells.get("A1").putValue("Hello World");
const outputData = workbook.save(SaveFormat.Xlsx);
const blob = new Blob([outputData]);
const downloadLink = document.createElement('a');
downloadLink.href = URL.createObjectURL(blob);
downloadLink.textContent = 'Download';
downloadLink.download = "hello-world.xlsx";
downloadLink.style.display = 'block';
document.body.append(downloadLink);
});
</script>
</html>
You need to use encrypt_lic.html in a http server to get the encrypted license file (aspose.cells.enc) in order to run in full-featured mode. To run the http server:
cd node_modules/aspose.cells.js
python -m http.server 8080
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<input type="file" id="fileInput" />
<button id="toPdf">Save to Pdf</button>
<a id="downloadLink" style="display: none;">Download</a>
</body>
<script src="aspose.cells.js.min.js"></script>
<script type="text/javascript">
const { Workbook, SaveFormat } = AsposeCells;
AsposeCells.onReady({
license: "/lic/aspose.cells.enc",
fontPath: "/fonts/",
fontList: [
"arial.ttf",
"NotoSansSC-Regular.ttf"
]
}).then(() => {
});
async function openSave(saveFormat, extension) {
const fileInput = document.getElementById('fileInput');
if (!fileInput.files.length) {
alert('Please select an Excel file.');
return;
}
const file = fileInput.files[0];
const arrayBuffer = await file.arrayBuffer();
var workbook = new Workbook(new Uint8Array(arrayBuffer));
const outputData = workbook.save(saveFormat);
const blob = new Blob([outputData]);
const downloadLink = document.getElementById('downloadLink');
downloadLink.href = URL.createObjectURL(blob);
downloadLink.download = 'output.' + extension;
downloadLink.style.display = 'block';
}
document.getElementById('toPdf').addEventListener('click', async () => {
await openSave(SaveFormat.Pdf, "pdf");
});
</script>
</html>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
<script src="aspose.cells.js.min.js"></script>
<script type="text/javascript">
const { Workbook, Color, SaveFormat } = AsposeCells;
AsposeCells.onReady().then(() => {
var workbook = new Workbook();
var style = workbook.createStyle();
style.font.setName("Times New Roman");
style.font.color = Color.Blue;
for (var i = 0; i < 10; i++) {
var cell = workbook.worksheets.get(0).cells.get(0, i);
cell.putValue(i);
cell.setStyle(style);
}
const outputData = workbook.save(SaveFormat.Xlsx);
const blob = new Blob([outputData]);
const downloadLink = document.createElement('a');
downloadLink.href = URL.createObjectURL(blob);
downloadLink.textContent = 'Download';
downloadLink.download = "style-example.xlsx";
downloadLink.style.display = 'block';
document.body.append(downloadLink);
});
</script>
</html>
const fs = require("fs");
const { AsposeCells } = require("aspose.cells.js");
const { Workbook, SaveFormat } = AsposeCells;
AsposeCells.onReady({
license: "aspose.cells.enc",
fontPath: "./fonts/",
fontList: [
"arial.ttf",
"NotoSansSC-Regular.ttf"
]
}).then(() => {
const fileBuffer = fs.readFileSync("example.xlsx");
var workbook = new Workbook(new Uint8Array(fileBuffer));
const outputData = workbook.save(SaveFormat.Pdf);
fs.writeFileSync("output.pdf", outputData);
});
ES6
in Node.jsimport fs from 'fs';
import { AsposeCells } from 'aspose.cells.js';
const { Workbook, FileFormatType, SaveFormat } = AsposeCells;
AsposeCells.onReady({
license: "aspose.cells.enc",
fontPath: "./fonts/",
fontList: [
"arial.ttf",
"NotoSansSC-Regular.ttf"
]
}).then(() => {
var workbook = new Workbook(FileFormatType.Xlsx);
workbook.worksheets.get(0).cells.get("A1").putValue("Hello World");
const outputData = workbook.save(SaveFormat.Xlsx);
fs.writeFileSync("hello-es6.xlsx", outputData);
});
Note: Please save the above code as example.mjs file and run it using node example.mjs
.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<button id="customfunction">Custom Function</button>
<div id="log-container"></div>
</body>
<script src="aspose.cells.js.min.js"></script>
<script type="text/javascript">
const { Workbook, CalculationOptions, AbstractCalculationEngine } = AsposeCells;
AsposeCells.onReady().then(() => {
class CustomFunction extends AbstractCalculationEngine {
constructor() {
super();
}
calculate(data) {
var functionName = data.functionName;
if (functionName == "myarrayfunch") {
var r = new Array();
r[0] = [1.0, 2.0, 3.0, 4.0, 5.0];
data.calculatedValue = r;
return;
}
else if (functionName == "myarrayfuncv") {
var r = new Array();
r[0] = [1.0];
r[1] = [2.0];
r[2] = [3.0];
r[3] = [4.0];
r[4] = [5.0];
data.calculatedValue = r;
return;
}
else if (functionName == "myrange") {
data.calculatedValue = data.worksheet.cells.createRange("A1", "F1");
return;
}
else if (functionName == "UDFTest") {
data.calculatedValue = data.getParamValue(0);
}
}
};
async function calculateCustomFunction() {
var wb = new Workbook();
var sheet = wb.worksheets.get(0);
var cells = sheet.cells;
// Create table with data
var range = cells.createRange("B3:D5");
var arr = new Array();
arr[0] = ["AccountNum", "UDF", "Normal"];
arr[1] = ["Row01", "", ""];
arr[2] = ["Row02", "", ""];
range.value = arr;
var firstRow = range.firstRow;
var firstColumn = range.firstColumn;
var endRow = firstRow + range.rowCount;
var endColumn = firstColumn + range.columnCount;
sheet.listObjects.add(firstRow, firstColumn, endRow, endColumn, true);
// Populate formulas
cells.get("C5").formula = "=UDFTest([@AccountNum])";
cells.get("C4").formula = "=UDFTest([@AccountNum])"; // UDF formula
cells.get("D5").formula = "=[@AccountNum]";
cells.get("D4").formula = "=[@AccountNum]"; // Built-in formula comparison
// Calculate workbook
var opt = new CalculationOptions();
var customFunction = new CustomFunction();
opt.customEngine = customFunction;
wb.calculateFormula(opt);
addLog("Row01" == cells.get("C4").stringValue);
addLog("Row02" == cells.get("C5").stringValue);
addLog("Row01" == cells.get("D4").stringValue);
addLog("Row02" == cells.get("D5").stringValue);
var workbook = new Workbook();
var worksheet = workbook.worksheets.get(0);
// Get the cells collection in the sheet
var cells = worksheet.cells;
cells.get("A1").setArrayFormula("=myarrayfunch()", 1, 5);
cells.get("A2").setArrayFormula("=myarrayfuncv()", 5, 1);
cells.get("A7").setArrayFormula("=A1:E1*100", 1, 5);
cells.get("A8").setFormula("=sum(myrange())", 100);
var cf = new CustomFunction();
var cOpt = new CalculationOptions();
cOpt.customEngine = cf;
workbook.calculateFormula(cOpt);
for (var i = 0; i < 5; i++) {
addLog(i + 1.0 == cells.get(0, i).doubleValue);
}
for (var i = 1; i < 6; i++) {
addLog(i == cells.get(i, 0).doubleValue);
}
for (var i = 0; i < 5; i++) {
addLog(i * 100 + 100.0 == cells.get(6, i).doubleValue);
}
addLog(cells.get("A8").doubleValue == 15);
addLog("calculate custom function done.");
}
document.getElementById('customfunction').addEventListener('click', async () => {
document.getElementById('log-container').innerHTML = '';
await calculateCustomFunction();
});
});
function addLog(message) {
const logContainer = document.getElementById('log-container');
const messageSpan = document.createElement('span');
messageSpan.textContent = message;
logContainer.appendChild(messageSpan);
logContainer.appendChild(document.createElement('br'))
logContainer.scrollTop = logContainer.scrollHeight;
}
</script>
</html>
Product Page | Product Documentation | Blog |API Reference | Free Support | Temporary License
FAQs
Aspose.Cells for JavaScript via C++ is a high-performance, feature-rich library for manipulating and converting Excel (XLS, XLSX, XLSB), ODS, CSV, and HTML files. It provides a comprehensive set of features for creating, editing, converting, and rendering
We found that aspose.cells.js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.