Forum Discussion
The input couldn't be recognized as a valid Excel document
- 9 years ago
One of the reason could be that the data that you are importing to PBI is not in excel table. Select the rows and columns from the sheet that you want to import >> Insert Table in excel and try importing it should be able to read the data then .
- 9 years ago
Please use the Issues Forum for reporting bugs or issues like this one. Link: http://aka.ms/issues.powerbi.com
This Community Forum is aimed at allowing users to interact/share solutions or questions for how to achieve something with Power BI, rather than reporting specific bugs (we have a whole separate forum for that :))
When reporting the issue, it would be good to clarify whether you're using PowerBI.com directly or are using Power BI Desktop to import your Excel Workbook. If you're using Power BI Desktop, any spreadsheet data is supported (does not need to be a table), so if you're running into this issue there, chances are that the Excel document has some invalid parts that make it unrecognizable.
Thanks,
M. - 9 years ago
Actually I don't think it is a bug. The user that supplied the excel spreadsheet had hidden the tabs that had the actual data. So technically PowerBI was correct. Might want to wait to hear back from the user before closing out and not getting all the information.
This isn't really a good solution for .xslx files that are already set tables. I have many files that a very simple tables. The nuance is that this file is being generated by a third party program (R) and the workaround is opening the file manually and saving it. No changes to the table/format etc. We want to automate this process but it's going to be a huge headache with no long term solution in place.
Have you found a solution to this ? I have the exact same issue.
- commercial_user3 years agoHelper I
Yes the best solution is running Powershell script and automated it through SQL Agent on a server or automating via window scheduler if on your personal computer. If you are running several files you can use the following two files
Config file
{
"LogFile" : "OpenSaveExcel.log",
"Files":
[
"C:\Program Files\test1.xlsx",
"C:\Program Files\test2.xlsx",
"C:\Program Files\test3.xlsx"
]
}Powershell script:
$config = Get-Content 'config.json' | Out-String | ConvertFrom-Json
$fileList = $config.Files
$logFile = $config.LogFilefunction WriteLog
{
param ([string]$logString)
Write-Host $logString
Add-content $logFile -value $logString
}$excelComObject = New-Object -COM "Excel.Application"
$excelComObject.DisplayAlerts = $falseforeach ($file in $fileList) {
$timeStamp = (Get-Date).toString("yyyy/MM/dd HH:mm:ss")
WriteLog "$timeStamp Processing file $file"
try {
$fileHandle = Get-Item -Path $file -erroraction stop
$fileHandle.IsReadOnly = $false
$wb = $excelComObject.Workbooks.Open($file, $true, $false)
$wb.Save()
$wb.Close()
} catch {
WriteLog "$timeStamp Error: $_"
}
WriteLog "$timeStamp Done processing file $file"
}$excelComObject.Quit()
[System.Runtime.Interopservices.Marshal]::ReleaseComObject($excelComObject)
Remove-Variable excelComObjectThis creates a error log and also runs the command to open the file, save, then closes the file.
Risks are permission issues if running on a virtual machine or server you may need to adjust for that when running remotely.