Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
github.com/jackhopner/grate
A Go native tabular data extraction package. Currently supports .xls
, .xlsx
, .csv
, .tsv
formats.
Grate focuses on speed and stability first, and makes no attempt to parse charts, figures, or other content types that may be present embedded within the input files. It tries to perform as few allocations as possible and errs on the side of caution.
There are certainly still some bugs and edge cases, but we have run it successfully on a set of 400k .xls
and .xlsx
files to catch many bugs and error conditions. Please file an issue with any feedback and additional problem files.
Grate provides a simple standard interface for all supported filetypes, allowing access to both named worksheets in spreadsheets and single tables in plaintext formats.
package main
import (
"fmt"
"os"
"strings"
"github.com/jackhopner/grate"
_ "github.com/jackhopner/grate/simple" // tsv and csv support
_ "github.com/jackhopner/grate/xls"
_ "github.com/jackhopner/grate/xlsx"
)
func main() {
wb, _ := grate.Open(os.Args[1]) // open the file
sheets, _ := wb.List() // list available sheets
for _, s := range sheets { // enumerate each sheet name
sheet, _ := wb.Get(s) // open the sheet
for sheet.Next() { // enumerate each row of data
row := sheet.Strings() // get the row's content as []string
fmt.Println(strings.Join(row, "\t"))
}
}
wb.Close()
}
All source code is licensed under the MIT License.
FAQs
Unknown package
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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.