Recommended Free Tools
To convert Excel data to CSV with SheetJS Community Edition, choose the worksheet you want and pass it to XLSX.utils.sheet_to_csv(ws, opts). The utility returns a JavaScript string, not a complete multi-sheet workbook: CSV represents one flat table at a time. Decide which sheet to export, then configure dates, blank rows, hidden data, separators and quoting for the system that will receive the file.
Choose a worksheet before exporting
Read the workbook, select a worksheet by name, then convert that worksheet. For example:
As an Amazon Associate I earn from qualifying purchases.
const workbook = XLSX.readFile("report.xlsx");
const sheetName = "Sales";
const worksheet = workbook.Sheets[sheetName];
if (!worksheet) {
throw new Error(`Worksheet not found: ${sheetName}`);
}
const csv = XLSX.utils.sheet_to_csv(worksheet);
sheet_to_csv accepts a worksheet object and returns a string. A workbook can contain multiple sheets, but a CSV has no workbook or sheet structure. Export the intended sheet explicitly, or repeat the operation for each sheet and give each result its own destination. SheetJS documents the worksheet utility in its CSV and Text API and discusses worksheet exports in its Data Export guidance.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteChoose between a string and a CSV file
Use sheet_to_csv when your application needs the CSV text to inspect, transform or send elsewhere. Use XLSX.write or XLSX.writeFile with CSV output when you want SheetJS to produce a file. These are distinct output routes, and their BOM behavior differs.
#1 Best Overall
- Used Book in Good Condition
| Route | Result | BOM behavior |
|---|---|---|
XLSX.utils.sheet_to_csv(worksheet, opts) |
JavaScript string for one worksheet | Does not include a byte-order mark |
XLSX.write or XLSX.writeFile with CSV output |
CSV file-oriented output | Includes a UTF-8 BOM for Excel compatibility |
The distinction can matter if a receiving application expects a particular first byte sequence. If you switch from the raw string utility to file writing, check whether the BOM is appropriate for that consumer. See SheetJS CSV utility documentation and Writing Files for the documented behavior.
Set the CSV shape for the receiving system
The defaults are comma-separated fields and newline-separated records. The utility also provides options for output details that downstream importers may care about.
Rank #2
| Option | Documented behavior | When to consider changing it |
|---|---|---|
FS |
Field separator; default is a comma | When the destination expects another delimiter |
RS |
Record separator; default is a newline | When the destination requires a particular line ending |
blankrows |
Blank lines are included by default | Set to false to omit blank lines |
skipHidden |
Hidden rows and columns are included by default | Set to true to omit hidden data |
dateNF |
Controls date formatting in string output | When a particular text representation is required for dates |
forceQuotes |
Defaults to false |
Set to true to quote every cell |
strip |
Removes trailing field separators | When the output should not retain trailing separators |
For example, a tab-separated export without empty lines can be produced as follows:
Free tools Windows power users keep installed
One-click scans. No signup required.
const csv = XLSX.utils.sheet_to_csv(worksheet, {
FS: "t",
blankrows: false
});
These settings affect the serialized text, not the choice of worksheet or the meaning of the underlying data. Confirm the receiving system’s delimiter, line-ending, blank-row and quoting expectations before exporting. The option definitions and defaults are in the SheetJS CSV and Text API.
Rank #3
Know when fields are quoted
SheetJS automatically wraps a field in double quotes when it contains the configured field separator or record separator. That protects separators inside a value from being treated as boundaries between cells or records. Set forceQuotes: true if the target requires every cell to be quoted, rather than only fields that need quoting.
Quoting is CSV syntax; it does not prevent spreadsheet applications from interpreting a value when someone opens the file. Applications may parse plaintext values according to their own rules, so do not assume that an exported string will display or behave identically in every spreadsheet program.
Rank #4
- Simple shift planning via an easy drag & drop interface
- Add time-off, sick leave, break entries and holidays
- Email schedules directly to your employees
Format dates as text deliberately
CSV stores dates as formatted text, not as Excel’s rich date type or its display behavior. Spreadsheet dates are commonly represented in Excel files as numeric date codes paired with number formats. When converting to CSV, choose the intended date text with dateNF rather than assuming the exported value will retain the spreadsheet’s date semantics.
const csv = XLSX.utils.sheet_to_csv(worksheet, {
dateNF: "yyyy-mm-dd"
});
The format string should match the requirements of the system that will consume the CSV. The CSV utility documentation describes dateNF for string output; the writing documentation describes writer behavior and date handling.
Best Value
Hidden rows and columns are exported unless you opt out
Hidden worksheet data is included by default. To omit it, set skipHidden: true:
const csv = XLSX.utils.sheet_to_csv(worksheet, {
skipHidden: true
});
There is a prerequisite: row and column settings are not saved by the read and readFile methods by default. Set cellStyles when reading if the text processor needs those settings to identify hidden rows and columns:
const workbook = XLSX.readFile("report.xlsx", {
cellStyles: true
});
Without the needed row and column settings available to the text processor, skipHidden cannot reliably make the export reflect hidden data. See the options in the CSV and Text API.
Do not assume export recalculates formulas
Formula extraction and formula export are separate concerns. For some input formats, formula parsing depends on enabling cellFormula when reading. The conversion documentation does not establish that CSV export recalculates formulas, so do not treat an export as a calculation step or promise refreshed formula results.
Plaintext input also has parsing considerations of its own: SheetJS applies delimiter heuristics to some legacy or ambiguous delimited files, and an explicit FS can be used where the delimiter is known. Codepage configuration matters for some older formats and for CSV input without a BOM in binary mode. These are read-side concerns rather than controls for choosing the worksheet to export. Consult Reading Files for parser options and File Formats for supported formats.
Quick Recap
A practical export checklist
- Identify the worksheet by name instead of relying on an accidental sheet order.
- Choose whether your application needs a JavaScript string or a file-oriented CSV writer.
- Match field and record separators to the destination.
- Decide whether blank rows and hidden rows or columns belong in the output.
- Set the text format for dates, and decide whether every field must be quoted.
- Check the output with the receiving application, especially if BOM handling or plaintext interpretation matters.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




