We're sorry GroupDocsCloud doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.cloud

How to convert csv to html

Can somebody help me out .I m converting csv to html using groupdocs. But In the converted html I m getting this .

<p>This page uses frames, but your browser doesn't support them.</p>

Bellow is my code

let fileApi = conversion_cloud.FileApi.fromKeys(clientId, clientSecret);

let uploaRequest = new conversion_cloud.UploadFileRequest(filePath,filecontent);


await fileApi.uploadFile(uploaRequest).then(async (result, err) => {
  if (err) {
    console.log("upload- ", err);
    return res.status(500).send(false);
  } else {
    console.log(" document uploaded", result);
  }
  let loadOptions = new conversion_cloud.CsvLoadOptions();
  loadOptions.separator = ",";
  loadOptions.convertDateTimeData = true;

  
 convertOptions = new conversion_cloud.HtmlConvertOptions();
 convertOptions.fixedLayout = false;
 convertOptions.usePdf = false;

  let settings = new conversion_cloud.ConvertSettings();
  settings.filePath = filePath;
  settings.format = "html";
  settings.loadOptions = loadOptions;
  settings.convertOptions = convertOptions;
 

  result = await convertApi.convertDocument(
    new conversion_cloud.ConvertDocumentRequest(settings)
  );
  console.log("CSV file converted to HTML successfully.");
  // console.log('Output HTML file:', outputFile);
  return res.send({
    data: result.toString(),
  });
});

@Lokesh7351

The CSV to HTML conversion is working fine with my sample documents. Please share your input and output documents with us for investigation.

can u share your code

Bellow is my csv file content

Name,Age,Email,Address
John Doe,30,john.doe@example.com,123 Main St
Jane Smith,25,jane.smith@example.com,456 Elm Ave
Michael Johnson,28,michael.johnson@example.com,789 Oak Rd
Emily Williams,32,emily.williams@example.com,101 Pine Lane

Output:

{
“data”: “\n<html xmlns:v=“urn:schemas-microsoft-com:vml”\nxmlns:o=“urn:schemas-microsoft-com:office:office”\nxmlns:x=“urn:schemas-microsoft-com:office:excel”\nxmlns=“http://www.w3.org/TR/REC-html40”>\n\n\n<meta name=“Excel Workbook Frameset” content=”"/>\n<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8”/>\n<meta name=“ProgId” content=“Excel.Sheet”/>\n<meta name=“Generator” content=“Aspose.Cell 23.5”/>\n<link rel=“File-List” href="/tmp/_files_files/filelist.xml"/>\n<link rel=“Edit-Time-Data” href="_files_files/editdata.mso"/>\n<link rel=“OLE-Object-Data” href="_files_files/oledata.mso"/>\n\n<![if !supportTabStrip]>\n<link id=“shLink” href="/tmp/_files_files/sheet001.htm"/>\n<link id=“shLink” href="/tmp/_files_files/sheet002.htm"/>\n\n<link id=“shLink”/>\n\n<script language=“JavaScript” type=“text/javascript”>\n\n\n\n<![endif]>\n\n\n <frameset rows="*,39">\n <frame src="/tmp/_files_files/sheet002.htm" name=“frSheet”/>\n <frame src="/tmp/_files_files/tabstrip.htm" name=“frTabs” marginwidth=“0” marginheight=“0”/>\n \n \n

This page uses frames, but your browser doesn’t support them.

\n \n \n \n\n"
}

@Lokesh7351

Please find the sample Node.js code to convert a CSV file to HTML from your local drive. Test_cust.zip (1.9 KB)

// load the module
var GroupDocs = require('groupdocs-conversion-cloud');
var fs = require('fs');

// get your appSid and appKey at https://dashboard.groupdocs.cloud (free registration is required).
var appSid = "xxxxxxx-xxxx-xxxxx-xxxx-xxxxxxxxx";
var appKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

const convertDocument = async () => {

// construct Api
var convertApi = GroupDocs.ConvertApi.fromKeys(appSid, appKey);


try {
    const format = "html";
    const loadOptions = new GroupDocs.CsvLoadOptions();
    const csvContent = fs.readFileSync('Test_cust.csv');
    loadOptions.format = "csv";

    const request = new GroupDocs.ConvertDocumentDirectRequest(
      format,
      csvContent,
      undefined,
      undefined,
      loadOptions,
      undefined);

    // convert document directly
      const result = await convertApi.convertDocumentDirect(request);
	console.log(result);
	fs.writeFileSync("CsvtoHTML.html", result);

} catch (err) {
throw err;
}
}

convertDocument()
.then(() => {
console.log("Document converted successfully");
})
.catch((err) => {
console.log("Error occurred while converting the document:", err);
})

yes …csv is converting. But when we are opening the converted html in the browser , then their is some text missing in the details.

For Instance ,if you review the converted HTML file.when you will open that file then in email ids after @ the text is missing .

How to fix this ?

If we are entering a large piece of text in a column, only half of it is being displayed in the converted html

@Lokesh7351
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CONVERSIONCLOUD-522

Can you tell me why this issue has been marked as ‘Blocked’?
Issue ID(s): CONVERSIONCLOUD-522

@Lokesh7351

Please note that after investigation, we noticed that the issue lies in the parent library (GroupDocs.Conversion for .NET) of GroupDocs.Conversion Cloud API. So we have logged a ticket in our internal system to fix the issue in GroupDocs.Conversion for .NET that is blocking the GroupDocs.Conversion Cloud API ticket.