react-data-export icon indicating copy to clipboard operation
react-data-export copied to clipboard

Cannot read property 'match' of undefined

Open Bilal-Abbas opened this issue 5 years ago • 15 comments

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

error

Bilal-Abbas avatar Apr 01 '20 16:04 Bilal-Abbas

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 avatar Apr 01 '20 18:04 sorokinvj

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

sorokinvj avatar Apr 01 '20 18:04 sorokinvj

Any luck?

Smriti29 avatar Apr 14 '20 18:04 Smriti29

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

Bilal-Abbas avatar Apr 15 '20 00:04 Bilal-Abbas

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:

Bilal-Abbas avatar Apr 15 '20 18:04 Bilal-Abbas

@Bilal-Abbas Thanks.. Its working :)

Smriti29 avatar Apr 17 '20 12:04 Smriti29

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

sorokinvj avatar Apr 24 '20 10:04 sorokinvj

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?

kalhan123 avatar Nov 26 '20 11:11 kalhan123

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

rajeshadduri avatar Nov 26 '20 18:11 rajeshadduri

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.

dhruv9499 avatar Dec 09 '20 16:12 dhruv9499

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

masoodqss avatar Dec 17 '20 06:12 masoodqss

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 avatar Mar 12 '21 12:03 Jaynish007

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?

Jaynish007 avatar Mar 12 '21 12:03 Jaynish007

I am getting so many errors Any help? ![Screenshot 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)

4mohdisa avatar Nov 14 '21 11:11 4mohdisa

@Bilal-Abbas It's working.

ashok-2695 avatar Nov 30 '21 10:11 ashok-2695