Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Corrupt file or an invalid file : when trying to open downloaded pbix file using Power BI Rest API.

Hello,

 

I am unable to open .pbix file when downloaded using Power BI Rest API, I have use Export report from group endpoint to donload the file. 

 

I have NodeJS as backend handling the API request. 

 

daoObj.exportReportgroupIdreportIdtoken).then(function (status) {  
                      res.status(200).send(status);
}, function (error) {
             ocalogger.error(tenantId'>>> Error exporting report: ' + reportId + ': 'error);
            deferred.reject(error);
});
 
 exportReport: function ( groupIdreportIdaccessToken) {
        var deferred = QRef.defer();
        const url = config.apiRoot + 'groups/' + groupId + '/reports/' + reportId + '/Export';
        const headers = {
            'Authorization': 'Bearer ' + accessToken
        };
        request.get({ url: url,  headers: headers}, function (errresponsebody) {
            if(response.statusCode === 200){
                deferred.resolve(response.body);
            }else{                
                if (err) {
                    deferred.reject(err);
                } else if (parsedBody.error) {
                    deferred.reject(parsedBody.error.message);
                } else {
                    // If successful, return the access token.
                    deferred.resolve(response.body);
                }
            }
            
        });
        return deferred.promise;
    }
 
The front end is ReactJS and I am using "file-saver" npm package to download the file.
 
handleExportReportEvent = (reportData) =>{
var self = this;
var reqBody = {};
reqBody.workspaceId = reportData.workspaceId;
reqBody.reportId = reportData.reportId;
this.props.exportReport(reqBody).then(() =>{
var blobObj = new Blob([self.props.exportReportObj.exportReportData] );
 FileSaver.saveAs(blobObj,  "report.pbix");
})
}
 
I am able to download the file, but when I try to open with the latest Power BI Desktop application, I am receving
"The report.pbix file is corrupt or an invalid file".
 
Please let me know where I am making a mistake
0 REPLIES 0

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.