securedeveloper / react-data-export

Export dataset in react.
https://securedeveloper.github.io/react-data-export/
MIT License
179 stars 194 forks source link

Cannot read property 'match' of undefined #130

Open Bilal-Abbas opened 4 years ago

Bilal-Abbas commented 4 years ago

I got stuck with the above issue. any help? My code is

error

sorokinvj commented 4 years ago

Having the same issue

xlsx.js:4334 Uncaught TypeError: Cannot read property 'match' of undefined
    at write_sst_xml (xlsx.js:4334)
    at write_sst (xlsx.js:8914)
    at write_zip (xlsx.js:11783)
    at write_zip_type (xlsx.js:11859)
    at Object.writeSync [as write] (xlsx.js:11873)
    at ExcelFile.download (ExcelFile.js:104)
    at HTMLUnknownElement.callCallback (react-dom.development.js:336)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:385)
    at invokeGuardedCallback (react-dom.development.js:440)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:454)
    at executeDispatch (react-dom.development.js:584)
    at executeDispatchesInOrder (react-dom.development.js:606)
    at executeDispatchesAndRelease (react-dom.development.js:713)
    at executeDispatchesAndReleaseTopLevel (react-dom.development.js:722)
    at forEachAccumulated (react-dom.development.js:694)
    at runEventsInBatch (react-dom.development.js:739)
    at runExtractedPluginEventsInBatch (react-dom.development.js:880)
    at handleTopLevel (react-dom.development.js:5803)
    at batchedEventUpdates$1 (react-dom.development.js:24401)
    at batchedEventUpdates (react-dom.development.js:1415)
    at dispatchEventForPluginEventSystem (react-dom.development.js:5894)
    at attemptToDispatchEvent (react-dom.development.js:6010)
    at dispatchEvent (react-dom.development.js:5914)
    at unstable_runWithPriority (scheduler.development.js:697)
    at runWithPriority$2 (react-dom.development.js:12149)
    at discreteUpdates$1 (react-dom.development.js:24417)
    at discreteUpdates (react-dom.development.js:1438)
    at dispatchDiscreteEvent (react-dom.development.js:5881)
sorokinvj commented 4 years ago

Ok, I got mine bug - one of the values in dataset was 'undefined', so this error was triggered

Smriti29 commented 4 years ago

Any luck?

Bilal-Abbas commented 4 years ago

Yeah. I will send you the trick in a moment :)

Bilal-Abbas commented 4 years ago

Following data formulation worked for me.

const data = [ { columns: [title: "Title"],  data: [ [value: "Value"] ] } ]

That is

const data = [
        {
          columns: [
            { title: "Order #" },
            { title: "Customer" },
            { title: "Ref #" },
            { title: "Status" },
            { title: "Total" },
            { title: "Sub Total" },
            { title: "Order Time" },
            { title: "Items Count" },
          ],
          data: csvData.map((order, index) => {
            return [
              { value: order.order_no },
              { value: order.customer_name },
              { value: order.ref_id},
              { value: this.getStatusName(order) },
              { value: order.total.toFixed(2) },
              { value: humanizeT(order.order_time) },
              { value: order.customer_name },
              { value: order.order_item_count },
            ];
          }),
        },
      ];

Import stuff

import ReactExport from "react-data-export";
const ExcelFile = ReactExport.ExcelFile;
const ExcelSheet = ReactExport.ExcelFile.ExcelSheet;

With dry code

<ExcelFile element={<button>Happy React</button>}>
   <ExcelSheet dataSet={data}  />
</ExcelFile>

Hope this will work :+1:

Smriti29 commented 4 years ago

@Bilal-Abbas Thanks.. Its working :)

sorokinvj commented 4 years ago

hey guys, just have another similar error - "Cannot read property 'match' of null", and it was because one of the {value: null} in multidataset.

So, just to sum up - all value's in your dataset must be not undefined and not null. If it is – there will be an error and code will break

kalhan123 commented 3 years ago

Hey guys, facing another similar error. "Cannot read property match of undefined" , only when i provide style attribute in the dataset. Any idea why it might be happening?

rajeshadduri commented 3 years ago

I tried the example from https://github.com/securedeveloper/react-data-export/blob/HEAD/examples/simple_excel_export_02.md

But I am getting below error, Can some please help ?

xlsx.js:4334 Uncaught TypeError: Cannot read property 'match' of undefined at write_sst_xml (xlsx.js:4334) at write_sst (xlsx.js:8914) at write_zip (xlsx.js:11783) at write_zip_type (xlsx.js:11859) at Object.writeSync [as write] (xlsx.js:11873) at ExcelFile.download (ExcelFile.js:104) at HTMLUnknownElement.callCallback (react-dom.development.js:336) at Object.invokeGuardedCallbackDev (react-dom.development.js:385) at invokeGuardedCallback (react-dom.development.js:440) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:45

dhruv9499 commented 3 years ago

I tried the example from https://github.com/securedeveloper/react-data-export/blob/HEAD/examples/simple_excel_export_02.md

But I am getting below error, Can some please help ?

xlsx.js:4334 Uncaught TypeError: Cannot read property 'match' of undefined at write_sst_xml (xlsx.js:4334) at write_sst (xlsx.js:8914) at write_zip (xlsx.js:11783) at write_zip_type (xlsx.js:11859) at Object.writeSync [as write] (xlsx.js:11873) at ExcelFile.download (ExcelFile.js:104) at HTMLUnknownElement.callCallback (react-dom.development.js:336) at Object.invokeGuardedCallbackDev (react-dom.development.js:385) at invokeGuardedCallback (react-dom.development.js:440) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:45

Same issue.

masoodqss commented 3 years ago

same issue here with this example https://github.com/securedeveloper/react-data-export/blob/HEAD/examples/simple_excel_export_02.md

Jaynish007 commented 3 years ago

same issue here with this example https://github.com/securedeveloper/react-data-export/blob/HEAD/examples/simple_excel_export_02.md

Did anybody find solution?

Jaynish007 commented 3 years ago

Following data formulation worked for me.

const data = [ { columns: [title: "Title"],  data: [ [value: "Value"] ] } ]

That is

const data = [
        {
          columns: [
            { title: "Order #" },
            { title: "Customer" },
            { title: "Ref #" },
            { title: "Status" },
            { title: "Total" },
            { title: "Sub Total" },
            { title: "Order Time" },
            { title: "Items Count" },
          ],
          data: csvData.map((order, index) => {
            return [
              { value: order.order_no },
              { value: order.customer_name },
              { value: order.ref_id},
              { value: this.getStatusName(order) },
              { value: order.total.toFixed(2) },
              { value: humanizeT(order.order_time) },
              { value: order.customer_name },
              { value: order.order_item_count },
            ];
          }),
        },
      ];

Import stuff

import ReactExport from "react-data-export";
const ExcelFile = ReactExport.ExcelFile;
const ExcelSheet = ReactExport.ExcelFile.ExcelSheet;

With dry code

<ExcelFile element={<button>Happy React</button>}>
   <ExcelSheet dataSet={data}  />
</ExcelFile>

Hope this will work 👍

How to download multiple sheet in one excel file?

4mohdisa commented 2 years ago

I am getting so many errors Any help? Screenshot []((8)) Screenshot (9)

2index.js:23 Error: Request failed with status code 403 at createError (createError.js:16) at settle (settle.js:17) at XMLHttpRequest.onloadend (xhr.js:66)

ashok-2695 commented 2 years ago

@Bilal-Abbas It's working.