'How to Parse XML saved in Excel cell
I have excel file which contains XML data in each cell of column, I want to parse those XML data in each cell and save each to new file. Here is my code:
import pandas as pd
import numpy as np
import xml.etree.cElementTree as et
file_path = r'C:\Users\user\Documents\datasets\sample.xlsx'
df = pd.read_excel(file_path)
for i in count_row:
pd.read_xml(df['XML'].iloc[i])
Solution 1:[1]
Instead of pandas, you could also look at openpyxl. This might make it easier for you to carve out the data that you need. You are mentioning that you want to parse the XML, but not specifying what you want to do with it... but, I would suggest xmltodict library for parsing XML.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Danny Meijer |
