如何仅使用Excel Power Query从Azure Blob存储中查询值?

时间:2019-03-25 15:38:49

标签: json excel azure powerquery azure-blob-storage

我正在尝试使用Excel Power Query从Azure Blob存储中查询一些聊天机器人数据。不幸的是,Excel单元格不仅包含值,而且每个单元格中都包含键。

这是我的Blob存储空间中Blob的一些示例内容。数据始终具有相同的结构。

{"id":"3398","realId":"3398","document":{"userID":"3398","name":"Testdurchgang","age":18,"gender":"männlich","education":"Diplom","complete":true,"advisoryConversationId":"6EFa4fsLaJhB4U1LlwNksU-f","roundCounter":5,"riskchoices":["A","A","A","A","B","B","B","B","B","B"],"riskAssessmentComplete":true,"riskDescription":"risikoneutral","order":["2","1","0"],"botRecommendation":"Breen GmbH","choice":"ACG GmbH","follow":false,"eTag":"*","resultConversationId":"Kxw9FZ2KwdWKqElSQQ0nG2-f","win1":"none","win2":"ACG GmbH","loss1":"Breen GmbH","loss2":"Plus GmbH","payout":"Du bekommst 6500 Geldeinheiten = 6,50€ ausgezahlt.","payoutNumber":"6,5"}}

这是Power Query工具中数据的外观:

enter image description here

如您所见,第一列甚至包含JSON中的括号,而第三列包含“ content”标记。在最好的情况下,我只需要每个单元格中的值。我可以根据需要手动设置列说明。

有没有办法做到这一点?

我知道我可以使用Excel函数来做到这一点,但这并不是一个很好的解决方案。

谢谢。

1 个答案:

答案 0 :(得分:2)

确保您存储在Storage blob容器中的文件为.json格式。

能够将您的示例内容上传到如下的blob中

{
	"id": "3398",
	"realId": "3398",
	"document": {
		"userID": "3398",
		"name": "Testdurchgang",
		"age": 18,
		"gender": "männlich",
		"education": "Diplom",
		"complete": true,
		"advisoryConversationId": "6EFa4fsLaJhB4U1LlwNksU-f",
		"roundCounter": 5,
		"riskchoices": [
			"A",
			"A",
			"A",
			"A",
			"B",
			"B",
			"B",
			"B",
			"B",
			"B"
		],
		"riskAssessmentComplete": true,
		"riskDescription": "risikoneutral",
		"order": [
			"2",
			"1",
			"0"
		],
		"botRecommendation": "Breen GmbH",
		"choice": "ACG GmbH",
		"follow": false,
		"eTag": "*",
		"resultConversationId": "Kxw9FZ2KwdWKqElSQQ0nG2-f",
		"win1": "none",
		"win2": "ACG GmbH",
		"loss1": "Breen GmbH",
		"loss2": "Plus GmbH",
		"payout": "Du bekommst 6500 Geldeinheiten = 6,50€ ausgezahlt.",
		"payoutNumber": "6,5"
	}
}

在excel中能够导入

enter image description here

单击Binary,然后应在下面看到

enter image description here

点击“记录”,应该会看到以下内容

enter image description here

插入表格应显示以下内容

enter image description here

希望以上步骤对您有所帮助!