Why won't my Excel external links work when they work in original I copied? - excel-formula

I am trying to validate data moved to a new server, through reports using old and new data. I copied the old report, and then went in to change the location. Everything looks good, I used the function wizard to make sure I had no typing / syntax errors, but I still get a #VALUE error.
The query:
=SUMIFS('EXTERNAL\[Report.xlsx]RPT_DATA'!$I:$I,
'EXTERNAL\[Report.xlsx]RPT_DATA'!$B:$B,$A$3,
'EXTERNAL\[Report.xlsx]RPT_DATA'!$C:$C,$C$6,
'EXTERNAL\[Report.xlsx]RPT_DATA'!$A:$A,"ACT")
All the criteria types match to the range, I have tried it with the external file open and not, and I just can't see what I'm doing wrong, since I copied it exactly from the existing report and JUST changed the external file to a different external file in the same location (essentially, from Q:\OldSource to Q:\NewSource - these are copies of the original and new, placed in the same "working" folder).
Any hints for troubleshooting?

Seems I had a stray _.
Dagnabbit

Related

Macro Enable Workbook is creating new file with SaveAsUI instead of saving itselft

I have to call the below line to save my workbook from another file:
Application.ActiveWorkbook.Save
For the needs of my project, this code needs to be and run in a different file than the one I have open and active.
When this code runs from another workbook, the file that I have it open and actived calls the SaveAsUI to save the file again, even if he was already saved.
Afther run of the code above, the original workbook is losted. I cannot save anymor the active workbook, manually or by macros, and I don't want to save as my original file. Several errors occur, such as:
random filename in the SaveAsUI
Unespected Error, AutoRecover Disabled
Share Rule Violation (PT/BR)
Sorry, I cannot catch this erro in english. Here its translation:
"Your changes could not be saved in 'File' due to a sharing violation. Try saving to another file."
I noticed that this error started after I enabled auto-save for the first time*. I don't know if it is something related to the cloud and Excel gets lost when saving. Also, testing saving the original file outside the network the problem did not appear
I haven't found anything like it on the internet and it has never happened before either.
PS: The workbook with I have enabled AutoSave has nothing to do with those that are giving error. That was a workbook without macros for a much simpler project.
I was able to find what was causing the problem. I initially thought it was the VBA macro part and the "ActiveWorkbook.save" command, but in the end the problem was much deeper.
It turns out that in the same macro that contained the save command there was a call to another function that updated the queries.
the error would stop when going into PowerQuery Editor, going into the spreadsheet query that would later give the share violation error, and in the steps remove the action of promoting the headers.
I have no idea why this is the error. But I tried several other ways in several other places (like every tip in this link1, or this link2, or this link3), the only way that resulted in the solution was this above (that I don't find in any place).
But the promotion of the headers is necessary, so to continue without giving problems I needed to go into the advanced editor and change the second parameter of the line below from "null" to "true" (which is basically to promote headers at the query stage).
let
Source = Excel.Workbook(File.Contents(FilePath), true, true),
With this, everthing now is working fine.

Cannot find where is missing external reference used

When I open my file, I get the message "missing external reference" (my Excel is in french, so the wording may be slightly different). I know I could break the reference, but I would like to know what I am doing exactly.
The source file disappeared (it is a file located in a temp directory).
As you know, Excel can tell the name of the missing files, but gives no information about where it is used (that sounds crazy to me : if it knows a data is missing, it must know where it is missing).
I tried to find where this reference is used :
Ctrl-F on the ref name in formulas : nothing
Macro search in the charts data : nothing
Macro search in the Pivotfield data sources : nothing
Macro search in the Shapes texts : nothing
Is there another way of looking this reference ?
It is not my file, but a rather old file uses by different people, and a large file with lots of things in it, so it is impossible to finc any person who can remember what might have been done in the past.
EDIT:
We sent back the file to another person involved in it. And he removed the links without any other check. So I hope the file will work OK that way : wait and see. Anyway, we will probably never know what was wrong in it.
I think this subject can be closed. It is still a detailed list of what should be checked in case of a broken link, and for that is useful.

POI XSSF - Can't add pictures to existing xlsx file

At this line:
wbk.addPicture(iconData, Workbook.PICTURE_TYPE_PNG);
I get this exception:
org.apache.poi.openxml4j.exceptions.PartAlreadyExistsException: A part with the name '/xl/media/image2.png' already exists : Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names. [M1.12]
That same line of code has worked perfectly before. If I open the xlsx file with 7zip, there is actually a image named image2.png, which is correct and is another picture added by hand with Excel. It's like it tries to add the new image with the same name as the existing image. What am I doing wrong?
I was editing a file that was saved with LibreOffice 6.1, after opening it in Excel and saving it, it worked.
Also, like #Gagravarr said, a upgrade will be better and will probably work without needing to use Excel only

Power BI unable to read excel worksheet with multiple tabs

I have an excel worksheet with 10 tabs.
For each tab, the data is structured as follows:
All tabs follow this same basic structure.
In Power BI, when I go to "Get Data", and then choose the .xlsx file, I get the following error:
Unable to connect
We encountered an error while trying to connect.
Details: "The input couldn't be recognized as a valid Excel document."
This is very frustrating and I don't know how such a simple task cannot be accomplished in Power BI.
Thank you.
Such alert could appear when you try to use Power BI connector on Excel file. It's understandable if the source file is corrupted and can't be opened in Excel. However, it looks strange if Excel opens the file in question and shows nothing wrong.
Based on our experience above is usually means what something is wrong with XML scheme of the Excel workbook.
Mushup trace (Data->New Query->Query Options->Diagnostics->Enable tracing) could give some additional information, but often not enough to find the reason.
We had two main scenarios
XML scheme is not complete
Usually if Excel file was generated by third-party tool. Such tool could generate quite limited XML scheme which is enough to open the file in Excel and to work with it, but not enough for Power BI connector. As an example, trace log shows
[DataFormat.Error] The input couldn't be recognized as a valid Excel document.\r\nStackTrace:\n…
…
[DataFormat.Error] We couldn't find a part named '/xl/sharedStrings.xml' in the Excel package.\r\nStackTrace:\n…
Such case is easy to fix – it's enough to open the file in Excel and save it (without any changes) – Excel is clever enough to fix the scheme. For the routine regular tasks we use poweshell script which does exactly the same in background.
There is the link within Excel file which is not recognizable as valid
Usually if Excel file is synced/kept with some cloud storage. One of the variants, wrong link could appear with copy/paste from another such file. That could be active link in one of the cells; or the link within conditional formatting formula; or even the link which actually isn't used by Excel but kept somewhere inside the scheme. For example, in one of the files I found in Data->Consolidate->All references the link like
'\drive.tresorit.com#7235\Tresors….[file.xlsx]Sheet'!$AC$6:$AC$357
on the file which was deleted long ago and isn't used, but for some strange reason the link was kept within the scheme.
Unfortunately for such case trace log doesn't give enough information to localize the issue, it looks like
[DataFormat.Error] The input couldn't be recognized as a valid Excel document.\r\nStackTrace:\n…
…
nExceptionType: System.UriFormatException, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\r\nMessage: Invalid URI: The hostname could not be parsed.\r\nStackTrace:\n
Perhaps I have not enough knowledge for more straight forward localization of the problem, but the only way is to exclude Excel file parts one by one and check if the issue disappeared. Another way could be to unzip Excel file and check if wookbook.xml or sheetNN.xml have something suspicious inside.

MS Access Error: "External table not in the expected format" when trying to open linked table which previously worked

I have some queries in my Access database which pull data from Excel files that appear in the database as linked tables. They have worked just fine, until suddenly and inexplicably I was getting the error "External table is not in the expected format," when trying to access them.
I thought it might have to do with the fact that I was using a macro-enabled workbook, but it was fine before. I do have a mail merge set up in Word which is linked to the database, and using one of the aforementioned queries.
It turns out that the issue was due to the mail merge document. Once I saved and closed the mail merge file in Word and tried accessing the queries and tables again in Access, the error was no longer appearing.
It seems that if a Word mail merge is connected to the database, this error may appear. I am not sure as to why a more appropriate error is not appearing; after testing it seems to happen regardless of whether the linked file is a macro-enabled workbook or not.
In short, as Olivier put it, the file was locked by Word. A simple issue, but not exactly clear given the error message (unless you follow Andre's logic that the expected format is a non-locked file, hahah).
I hope this helps someone else!
My form is hooked to a query. The "not in expected format" message happens when the query is set up as a "snapshot". When I changed to "dynaset", the form started to work as expected.

Resources