Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
html-to-xlsx
Advanced tools
node.js html to xlsx transformation
Transformation only supports html table and several basic style properties. No images or charts are currently supported.
const fs = require('fs')
const conversionFactory = require('html-to-xlsx')
const puppeteer = require('puppeteer')
const chromeEval = require('chrome-page-eval')({ puppeteer })
const conversion = conversionFactory({
extract: chromeEval
})
(async () => {
const stream = await conversion(`<table><tr><td>cell value</td></tr></table>`)
stream.pipe(fs.createWriteStream('/path/to/output.xlsx'))
})()
background-color
- cell background colorcolor
- cell foreground colorborder-left-style
- as well as positions will be transformed into excel cells borderstext-align
- text horizontal align in the excel cellvertical-align
- vertical align in the excel cellwidth
- the excel column will get the highest width, it can be little bit inaccurate because of pixel to excel points conversionheight
- the excel row will get the highest heightfont-size
- font sizecolspan
- numeric value that merges current column with columns to the rightrowspan
- numeric value that merges current row with rows below.overflow
- the excel cell will have text wrap enabled if this is set to scoll.const conversionFactory = require('html-to-xlsx')
const puppeteer = require('puppeteer')
const chromeEval = require('chrome-page-eval')({ puppeteer })
const conversion = conversionFactory({ /*[constructor options here]*/})
extract
function [required] - a function that receives some input (an html file path and a script) and should return some data after been evaluated the html passed. the input that the function receives is:
{
html: <file path to a html file>,
scriptFn: <string that contains a javascript function to evaluate in the html>,
timeout: <time in ms to wait for the function to complete, the function should use this value to abort any execution when the time has passed>,
/*options passed to `conversion` will be propagated to the input of this function too*/
}
tmpDir
string - the directory path that the module is going to use to save temporary files needed during the conversion. defaults to require('os').tmpdir()
timeout
number - time in ms to wait for the conversion to complete, when the timeout is reached the conversion is cancelled. defaults to 10000
const fs = require('fs')
const conversionFactory = require('html-to-xlsx')
const puppeteer = require('puppeteer')
const chromeEval = require('chrome-page-eval')({ puppeteer })
const conversion = conversionFactory({
extract: chromeEval
})
(async () => {
const stream = await conversion(/* html */, /* extract options */)
})()
html
string - the html source that will be transformed to an xlsx, the html should contain a table elementextractOptions
object - additional options to pass to the specified extract
functionSee license
FAQs
Convert html to xlsx
The npm package html-to-xlsx receives a total of 1,298 weekly downloads. As such, html-to-xlsx popularity was classified as popular.
We found that html-to-xlsx demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.