Бахтиёр Пользователь Сообщений: 1897 Excel 365 |
#1 23.04.2021 15:26:58 Добрый день.
Как узнать в каком файле ошибка? Прикрепленные файлы
|
||
Бахтиёр Пользователь Сообщений: 1897 Excel 365 |
в папке только файлы xlsx и xlsm можно ли как-то узнать на каом именно файле ругается? Изменено: Бахтиёр — 23.04.2021 16:06:12 |
Owlet Пользователь Сообщений: 191 |
Бахтиёр, а на шаге «Вызвать настраиваемую функцию» не видно, в какой файле error? Изменено: Owlet — 23.04.2021 16:25:46 |
Михаил Л Пользователь Сообщений: 2601 |
#4 23.04.2021 17:25:38
У меня такой же вопрос
Изменено: Михаил Л — 23.04.2021 18:17:13 НА МЯСО В ПРОФИЛЕ |
||||
Бахтиёр Пользователь Сообщений: 1897 Excel 365 |
Извиняюсь а где именно можно увидеть ошибку? Прикрепленные файлы
|
Михаил Л Пользователь Сообщений: 2601 |
Бахтиёр, в самом правом столбце. То бишь в последнем столбце с названием — Преобразовать файл |
Бахтиёр Пользователь Сообщений: 1897 Excel 365 |
#7 23.04.2021 19:04:49 Михаил Л, Owlet, спасибо большое.
сделал на нём ПКМ —> Сохранить ошибки и увидел файлы с ошибками |
||
Meenanisela Пользователь Сообщений: 3 |
#8 07.02.2022 12:38:09 У меня была такая же ошибка, источник её оказался временный файл с «~$» в начале названия. Поэтому если вы загружаете с папки, то при фильтрации списка файлов, исключите все файлы содержащие сочетание «~$». |
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.rnStackTrace:n… … [DataFormat.Error] We couldn't find a part named '/xl/sharedStrings.xml' in the Excel package.rnStackTrace: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@7235Tresors….[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.rnStackTrace:n… … nExceptionType: System.UriFormatException, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089rnMessage: Invalid URI: The hostname could not be parsed.rnStackTrace: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.
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.rnStackTrace:n… … [DataFormat.Error] We couldn't find a part named '/xl/sharedStrings.xml' in the Excel package.rnStackTrace: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@7235Tresors….[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.rnStackTrace:n… … nExceptionType: System.UriFormatException, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089rnMessage: Invalid URI: The hostname could not be parsed.rnStackTrace: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.
Файлы к уроку:
- Для спонсоров Boosty
- Для спонсоров VK
- YouTube
- VK
Ссылки:
- Страница курса
- Плейлист YouTube
- Плейлист ВК
Описание
Мы собираемся импортировать таблицу с этой страницы. Когда мы пытаемся изменить тип данных для столбцов с датой, то возвращается столбец с ошибкой DateFormat.Error.
Решение
Если не получается преобразовать столбец с текстом в дату, то значит в строке присутствуют лишние символы.
С помощь функции Text.Length мы можем убедиться, что длина строки намного больше, чем ожидается. Мы видим 10 символов, но функция возвращает 15.
С помощью функции Text.Start извлечем 1 символ сначала строки. Потом получим код этого символа с помощью функции Character.ToNumber. Получаем 8206.
Далее воспользуемся функционалом замены подстроки и исправляем получившуюся формулу:
Table.ReplaceValue(
get_table,
Character.FromNumber(8206),
"",
Replacer.ReplaceText,
{
"Дата начала купонного периода",
"Дата выплаты купона",
"Дата фиксации списка держателей"
}
)
Примененные функции
- Text.Length
- Text.Start
- Character.ToNumber
- Web.Page
- Web.Contents
- Table.SelectRows
- Table.ReplaceValue
- Character.FromNumber
- Replacer.ReplaceText
- Table.TransformColumnTypes
Код
let
source = Web.Page(
Web.Contents(
"https://www.moex.com/ru/issue.aspx?board=TQCB&code=RU000A102036#/bond_4"
)
),
get_table = Table.SelectRows(
source,
each ([ClassName] = "coupon-payment-schedule__table")
){0}[Data],
cols_replace = Table.ReplaceValue(
get_table,
Character.FromNumber(8206),
"",
Replacer.ReplaceText,
{
"Дата начала купонного периода",
"Дата выплаты купона",
"Дата фиксации списка держателей"
}
),
cols_types = Table.TransformColumnTypes(
cols_replace,
{
{"Дата начала купонного периода", type date},
{"Дата выплаты купона", type date},
{"Дата фиксации списка держателей", type date}
}
)
in
cols_types
Этот урок входит в курс Работа с ошибками в Power Query
Номер урока | Урок | Описание |
---|---|---|
1 | Power Query Ошибки №1. Измененный тип, Неверная фильтрация в UI | Почему возникает ошибка Expression.Error Столбец таблицы не найден? Одна из причин — шаг Измененный тип. Почему в вашей итоговой таблицы не все данные, которые должны там оказаться? Вероятно вы совершили ошибку неверной фильтрации в пользовательском интерфейсе. |
2 | Power Query Ошибки №2. Фиксированная ширина столбца Excel | В этом уроке вы узнаете как отключить автоматическое определение ширины столбцов таблицы Excel при обновлении запроса Power Query. |
3 | Power Query Ошибки №3. Formula Firewall, запрос ссылается на… | Вы работаете в Power Query, но при попытке обновить все возникает ошибка Formula Firewall, запрос ссылается на… Что делать? Как исправить? |
4 | Power Query Ошибки №4. Доступ к веб-содержимому | В этом уроке вы узнаете как избавиться от надоедливого окна доступ к веб-содержимому. |
5 | Power Query Ошибки №5. Количество столбцов CSV | При импорте CSV получается неверное количество столбцов. |
6 | Power Query Ошибки №6. Не получается изменить тип данных (DataFormat.Error) | При попытке изменить тип данных с текстового на дату возникает ошибка DataFormat.Error. |
7 | Power Query Ошибки №7. Разные имена листов | В этом уроке мы решим проблему, когда в ваших источниках нужные вам данные находятся всегда на листах с разными именами. |
8 | Power Query Ошибки №8. Разные имена листов 2 | В этом уроке мы другими способами решим проблему, когда в ваших источниках нужные вам данные находятся всегда на листах с разными именами. |
9 | Power Query Ошибки №9. Разные имена столбцов, Table.TransformColumnNames | В этом уроке мы разберем проблему, когда нам присылают файлы, в которых всегда столбцы названы по-разному. |
10 | Power Query Ошибки №10. Как развернуть все столбцы | В этой задаче мы научимся разворачивать все столбцы табличного столбца не перечисляя каждый из них хардкодом. |
11 | Power Query Ошибки №11. Подключиться к последнему файлу | В этом уроке мы научимся подключаться к самому свежему файлу из нужной нам папки с нужным названием. |
12 | Power Query Ошибки №12. Консолидация и MissingField.Type | Бывает вы ходите выполнить добавление таблиц друг под другом с предварительной обработкой, но получаете ошибку Expression.Error: Столбец таблицы не найден. |
13 | Power Query Ошибки №13. Удалить пустые столбцы | Как без хардкода автоматически удалить пустые столбцы в Power Query, которые есть в импортируемой таблицы. Разберем 2 способа. Один из них прост до безобразия, а для второго понадобится функция Table.Profile. |
14 | Power Query Ошибки №14. Удалить лишние пробелы | В этом уроке мы разберем еще 1 способ удалить лишние пробелы в текстовом столбце Power Query. Для этого мы повторим и изучим несколько новых функций. Text.SplitAny List.Select Character.FromNumber Text.Combine |
15 | Power Query Ошибки №15. Плохо структурированный TXT | Как быть, если текстовый файл разбивается на столбцы неправильно? |
16 | Power Query Ошибки №16. При округлении не совпадает общая сумма | Разберем ошибку, которая возникает при необходимости разбить число на определенные доли, а результаты округлить до двух знаков после запятой. В такой ситуации может получиться, что сумма слагаемых не будет равняться исходному числу. |
17 | Power Query Ошибки №17. Удаление дубликатов, Подводные камни Table. Distinct | Что может пойти не так при использовании функции удаления дубликатов. |
18 | Power Query Ошибки №18. Удаление дубликатов 2, Подводные камни Table. Distinct | Что может пойти не так при использовании функции удаления дубликатов. Другое решение данной проблемы. |
19 | Power Query Ошибки №19. Неверная разбивка на столбцы | При импорте данных из CSV или TXT разбивка на столбцы происходит неправильно. |
20 | Power Query Ошибки №20. Пустая таблица при импорте Excel (XLSX, XLS) | Вы пытаетесь подключиться к книге Excel, но импортируется пустая таблица. |
21 | Power Query Ошибки №21. Подключение к PostgreSQL, Установка драйвера | Вы пытаетесь подключиться к PostgreSQL и получаете ошибку «Перед использование этого соединителя необходимо установить один или несколько дополнительных компонентов» |
- Remove From My Forums
-
Вопрос
-
Trying to make a query to closed xlsx workbook causes DataFormat.Error (inappropriate Excel file or something like this). PQ shows me a sheet in this file, but in preview (or when tried to load data) PQ shows an error with description
BinaryWhen this file opened in Excel — PowerQuery works in it as usual and everything is ok. But if file closed and I trying to get data «From file… -> Excel file» I got this error again.
This is an output format of 1C (very popular in Russia accounting program). If I open it (Excel make no alerts about unappropriate file format), save immediatly, close — then PQ works fine with closed file.
It causes problems for me because I cannot change file format on source, and opening and saving each file I have to proocess is…. I can write a VBA macro for open file, save etc. but… it is very inconvenient.
Do this issue has a solution? Where I should look for the source of error?
Thank for any suggestions
Ответы
-
Hi Maxim. Thanks for reporting this. Can you send a frown? If you can attach one of the problematic files to the frown mail, that would be very helpful as well.
Ehren
-
Предложено в качестве ответа
22 октября 2015 г. 19:36
-
Помечено в качестве ответа
Ed Price — MSFTMicrosoft employee
18 января 2016 г. 6:40
-
Предложено в качестве ответа
в Эксель. Подключаю файл Эксель к PBI. получаю такую ошибку:
В запросе «Преобразовать файл (7)» произошла ошибка. DataFormat.Error: Входные данные не удалось распознать как допустимый документ Excel.
пересохраняю файл Эксель и все работает нормально. Что делать??
russian
pbi
9
ответов
сохранять в csv изначально
Спасибо за вариант. А если все-таки эксель??
Написать сервис, который будет принимать excel, а возвращать json, а из PowerBI забирать данные из этого сервиса. Я бы так сделал, если без БД.
Если есть БД, то сначала туда класть, а из нее уже в Pbi.
а чем вас csv не устроил? это стандарт выгрузки у нее
вам из него просто читать, не анализировать и разбирать
согласен, надо перенастроиться.
1с неправильно сохраняет екселевские файлы, нужно что бы программист 1с это исправил
Есть пример решение на инфостате с описанием проблемы и кодом. В архиве екселевского файла что-то не правильно называется, по этому пересохранение решает проблему