【问题标题】:Excel - "expression.error: the column 'Date' of the table was not found" even though it exists in the tableExcel - “表达式.错误:未找到表的“日期”列”,即使它存在于表中
【发布时间】:2021-03-05 03:11:25
【问题描述】:

在 excel 中刷新查询时,我遇到了一个弹出错误,并且不允许我转到发生错误的位置。在电源查询编辑器中,没有出现错误。当我退出电源查询编辑器并尝试将查询加载到表中时,出现表达式错误。以下是电源查询编辑器显示日期的屏幕截图:

但是当我尝试按日期过滤表格时,我得到:

代码中出现错误的地方在这里:

let
Source = Csv.Document(Parameter3,[Delimiter=",", Columns=13, Encoding=65001, QuoteStyle=QuoteStyle.Csv]),
#"Removed Top Rows" = Table.Skip(Source,2),
#"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date", type date}, {"Domain", type text}, {"Content", type text}, {"Sender Profile Image Url", type text}, {"Created Time", type datetime}, {"Permalink", type text}, {"snTypeColumn", type text}, {"Associated Cases", type text}, {"Product Brand Name", type text}, {"Product", type text}, {"Sentiment", type text}, {"Star Rating", Int64.Type}, {"Experience Score", Int64.Type}})

在 #"改变类型"

这是我查询的表:

{"Date", type date}, {"Domain", type text}, {"Content", type text}, {"Sender Profile Image Url", type text}, {"Created Time", type datetime}, {"Permalink", type text}, {"snTypeColumn", type text}, {"Associated Cases", type text}, {"Product Brand Name", type text}, {"Product", type text}, {"Sentiment", type text}, {"Star Rating", Int64.Type}, {"Experience Score", Int64.Type}}

【问题讨论】:

  • 请发布您的完整代码,以及该表的起始数据视图
  • 或者,如果您可以共享示例文件,那么有人可能会找出问题所在。
  • @TerryW:这不是 SO 的工作方式。如果无法在问题本身中提供信息,则该问题不适合本网站。您不能在外部发布文件,然后要求人们去获取该文件并解决问题。

标签: excel excel-formula powerbi powerquery


【解决方案1】:

这是我为这个问题调试的部分: 查看了用作源的目录中的文件。注意到一些文件的标题列在顶行,而其他文件(大多数)有两个文档信息行。因此,此查询的前任所有者假设有两行数据对于查询来说是不必要的,因此添加了 #"Removed Top Rows" = Table.Skip(Source,2) 以跳过这两个最重要的信息行。

  1. 我浏览了查询的文件,遍历每个文件并添加两个新行,如果它们被编辑以取出前两行
  2. 然后我尝试了,但遇到了其他错误,因此我检查了文件扩展名。当此查询调用时,某些文件是 xlsx:Csv.Document(Parameter3,[Delimiter=",", Columns=13, Encoding=65001, QuoteStyle=QuoteStyle.Csv])
  3. 我更改/修改/删除了任何导致其他问题的 xlsx 文件
  4. 完成逻辑后查询成功完成

要点:有时手动检查每个文件可以克服查询问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-04-02
    • 1970-01-01
    • 1970-01-01
    • 2020-06-22
    • 2016-06-02
    • 2021-09-17
    • 1970-01-01
    • 2023-01-14
    相关资源
    最近更新 更多