0

The ask is to generate the csv file from JSON data in the format

jsonObj = {'key1' : 'value1',
           'key2' : 'value2',...}

I need to generate the CSV file using name cell format with 2 columns only

key1    value1
key2    value2
.       .
.       .
.       .

Including the concept of name cell where clicking on the cell 'value1' the cell is referred to as 'key1' instead of B1. I am using exportToCSV library in angular but could not find any. Code for Reference

` let csvData = [data.data];
    const options = {
      filename: "Q_String_" + primaryKey,
      fieldSeparator: ",",
      quoteStrings: '"',
      decimalSeparator: ".",
      showLabels: true,
      useTextFile: false,
      useBom: true,
      useKeysAsHeaders: true,
    };

    const csvExporter = new ExportToCsv(options);
    csvExporter.generateCsv(csvData);
    this.toastr.success("Q String has been downloaded","Success"); `

Any help would be appreciated?

8
  • Can you post the code you tried and explain why it didn't work? Commented Apr 18, 2022 at 11:51
  • Ok @Nick.McDermaid Commented Apr 18, 2022 at 12:29
  • and why didn't it work? Commented Apr 18, 2022 at 12:32
  • @Nick.McDermaid. its generating two rows with key (first row) and value (second row) without naming cell references. I need it to get in two columns having a ability of naming a cell with their keys. For Ref, link Commented Apr 18, 2022 at 12:38
  • Can you edit the question and add a sample of what it is producing? Commented Apr 18, 2022 at 12:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.