Load CSV document with options

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Conversion MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-conversion -- dnx GroupDocs.Conversion.Mcp --yes
Folders, licensing and more →

GroupDocs.Conversion provides CsvLoadOptions to give you control over how the source CSV document will be processed. The following options could be set:

Control behavior of converting date/time and numeric data

The following code snippet shows how to convert a CSV document and control the way the date/time and numeric data have been processed:

const loadOptions = new groupdocs.conversion.CsvLoadOptions()
loadOptions.setConvertDateTimeData(true)
loadOptions.setConvertNumericData(true)

const outputPath = "ConvertCsvByConvertingDateTimeAndNumericData.pdf"

const converter = new groupdocs.conversion.Converter("sample.csv", loadOptions)
const convertOptions = new groupdocs.conversion.PdfConvertOptions()

console.log(`CSV document converted successfully to ${outputPath} (converting dateTime & numeric data)`)
converter.convert(outputPath, convertOptions)

Specify delimiter

The following code snippet shows how to convert a CSV document and specify the delimiter:

const loadOptions = new groupdocs.conversion.CsvLoadOptions()
loadOptions.setSeparator(",")

const outputPath = `ConvertCsvBySpecifyingDelimiter.pdf`

const converter = new groupdocs.conversion.Converter("sample.csv", loadOptions)
const convertOptions = new groupdocs.conversion.PdfConvertOptions()

console.log(`CSV document converted successfully to ${outputPath} (specifying delimiter)`)
converter.convert(outputPath, convertOptions)

Specify encoding

The following code snippet shows how to convert a CSV document and specify the encoding:

const loadOptions = new groupdocs.conversion.CsvLoadOptions()
loadOptions.setEncoding("Shift_JIS")

const outputPath = `ConvertCsvBySpecifyingEncoding.pdf`

const converter = new groupdocs.conversion.Converter("sample.csv", loadOptions)
const convertOptions = new groupdocs.conversion.PdfConvertOptions()

console.log(`CSV document converted successfully to ${outputPath} (encoding specified)`)
converter.convert(outputPath, convertOptions)