How to download excel in response from api react js

0 votes

My api is responding like this demo [URL][https://mytutari.com/webservices/contract/exportcallnote/10377431] If i click on url it get downloaded automatically. But when I try to post some data using POST request in axios response I am getting this how to handle. API response

> PKk)S docProps/PKk)SéÙ£docProps/app.xmlÏ1ƒ0ཿB²kl‡R$êR:w°ÝCrjÀÜIrý÷M)Ô½ããÁÇ{ª]ý”-¢#¬Å±(EhÈ:jñènùEd‘5Z=B-6ˆ¢mêh†Àb–Œµ™çJÊhFð:©ÆÔô¼æÃ
> ©ï+™—dy*˳„•-Ø|þâ+Vÿ‹Z2Ÿ}ñÙmsòÕë©sšRÉ=(¹ßhÞPKk)S…]ØÓ
> docProps/core.xmlm‘ËNÃ0E÷|Eä}b;¨²’t*Ø ÎZÄÙ¦iùz’´
> uçñ=>šñ‹­n“ ú ¬)  ÏIÐH[+Ó”äyµLç$  L
> ­5X’²¨.PKk)S  docProps/PKk)SéÙ£docProps/app.xmlÏ1ƒ0ཿB²kl‡R$êR:w°ÝCrjÀÜIrý÷M)Ô½ããÁÇ{ª]ý”-¢#¬Å±(EhÈ:jñènùEd‘5Z=B-6ˆ¢mêh†Àb–Œµ™çJÊhFð:©ÆÔô¼æÃ
> ©ï+™—dy*˳„•-Ø|þâ+Vÿ‹Z2Ÿ}ñÙmsòÕë©sšRÉ=(¹ßhÞPKk)S…]ØÓ
> docProps/core.xmlm‘ËNÃ0E÷|Eä}b;¨²’t*Ø ÎZÄÙ¦iùz’´
> uçñ=>šñ‹­n“ ú ¬)  ÏIÐH[+Ó”äyµLç$  L ­5X’²¨.

API call

 ```const formData = new FormData();
formData.append("DealerID", DealerID);
formData.append("FomDate", fromdate);
formData.append("ToDate", toDate);
formData.append("FixedDateParameter", FixedDateParameter);
formData.append("export_type", export_type);
//api
const dashboardexport_response = await dashboardexport({ formData });```

dashboardexport

  let url = API + "/dashboard/dashboardexport";

  formData.append("pcp_user_id", pcp_user_id);
  formData.append("role_id", role_id);
  formData.append("user_id", user_id);
  try {
    const response = await axios.post(url, formData, { header });
    return response.data;
  } catch (error) {
    throw Error(error);
  }
};```
 

Mar 28, 2022 in Database by Edureka
• 13,690 points
7,599 views

1 answer to this question.

0 votes

Create ReactJS project

  1. import React, { Component } from 'react'
  2. import axios from 'axios';
  3. import ReactHTMLTableToExcel from 'react-html-table-to-excel';
  4. export class ExportExcel extends Component {
  5. constructor(props) {
  6. super(props)
  7. this.state = {
  8. ProductData: []

If you need to know more about React, Its recommended to join React certification course today.

answered Mar 31, 2022 by gaurav
• 23,260 points

Related Questions In Database

0 votes
1 answer

How to download created excel file in node.js using exceljs

Download a sample Excel file using Node. ...READ MORE

answered Apr 4, 2022 in Database by Edureka
• 13,690 points
7,680 views
0 votes
0 answers

How to get address, Column Name and Row Name of all marked rows in Excel table as rows in new worksheet

 need the row/column combinations marked with an ...READ MORE

Feb 24, 2022 in Database by Edureka
• 13,690 points
1,979 views
0 votes
1 answer

How to count distinct values in Excel

Use functions to count the number of ...READ MORE

answered Mar 15, 2022 in Database by gaurav
• 23,260 points
1,343 views
0 votes
1 answer

[Excel][VBA] How to draw a line in a graph?

Sub MakeChart() Dim x(20) ...READ MORE

answered Mar 24, 2022 in Database by gaurav
• 23,260 points
1,934 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to Calculate DATEDIF formula in Excel?

Simply divide one date by the other. ...READ MORE

answered Mar 25, 2022 in Database by gaurav
• 23,260 points
1,058 views
0 votes
1 answer

how to Convert EST time to IST time in excel?

Use the following calculation since Indian Standard ...READ MORE

answered Mar 25, 2022 in Database by gaurav
• 23,260 points
1,912 views
0 votes
1 answer

How to sort dates from Oldest to Newest in Excel?

Drag down the column to select the ...READ MORE

answered Feb 23, 2022 in Database by gaurav
• 23,260 points
5,135 views
+1 vote
1 answer

how to change format of date from mm/dd/yyyy to dd-mmm-yyyy in MS Excel

First, pick the cells that contain dates, ...READ MORE

answered Apr 11, 2022 in Database by gaurav
• 23,260 points
158,321 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP