A Windows batch tool that wraps every data-cell value in double quotes (
value→"value") across all Excel files in a folder, using NPOI.
ExcelQuote is a small WinForms utility for batch-processing .xlsx files. For every file in a chosen folder, it opens the first worksheet and rewrites each data cell so its value is enclosed in double quotes, then saves the result to an output subfolder. The header row (row 1) is left untouched.
This is handy for preparing spreadsheet data for a downstream system or import format that expects text-qualified (quoted) values.
- Click Browse and select a folder containing
.xlsxfiles - Click the process button
- For each file, the app:
- opens the first sheet via NPOI (
XSSFWorkbook) - iterates every row except the header, and every column, setting the cell value to
"<original value>" - writes the modified workbook to
<folder>\output\<same filename>
- opens the first sheet via NPOI (
- C# / .NET Framework 4.5.2, WinForms
- NPOI — reads and writes Office Open XML (
.xlsx) without requiring Excel installed - ICSharpCode.SharpZipLib — NPOI dependency for the zip-based
.xlsxcontainer
ExcelQuote/
├── ExcelQuote.sln
└── ExcelQuote/
├── Program.cs # entry point
├── Form1.cs # UI + batch-quoting logic
├── lib/ # NPOI*.dll, ICSharpCode.SharpZipLib.dll
└── App.config
- Open
ExcelQuote.slnin Visual Studio (targets .NET Framework 4.5.2) - Ensure the references in
lib/(NPOI and SharpZipLib) resolve - Build and run, then select a folder of
.xlsxfiles and process
Before running: create an
outputsubfolder inside the selected folder (see Known issues).
outputfolder is not created automatically — the app writes to<folder>\output\but never creates that directory, so it throwsDirectoryNotFoundExceptionif it doesn't already exist. AddingDirectory.CreateDirectory(pathToDirOutput)before the loop would fix this.- Assumes every file is a valid
.xlsx—Directory.GetFilesreturns all files; a non-xlsx file (or a temp/lock file) will make NPOI throw. Filtering by*.xlsxwould be safer. - No null-cell handling — empty cells return
nullfromGetCell(j), which can cause aNullReferenceException. UseGetCell(j, MissingCellPolicy.CREATE_NULL_AS_BLANK)or a null check. - Column count is taken from the header row's
LastCellNum; rows with fewer cells than the header may fail.
A focused, single-purpose tool. The improvements above would make it robust enough for general reuse; as written it works for clean, uniform .xlsx inputs with a pre-existing output folder.