Link to home
Start Free TrialLog in
Avatar of rsburge
rsburgeFlag for United States of America

asked on

Update Excel Spreadsheet with Data from XML File

Hello -

I have an XML file that is generated by an Access database.  I need to update the existing rows with specific data from the xml file.

The Excel columns are
A - LnName
B - LnID
C - SiteInfo
D - Client

The fields in the XML file I need are
SiteInfo and Client

I need to look up the LnID from column B in the XML file and update columns C and D with the corresponding data from the XML file.  Similar to using a lookup formula.

I tried just importing the data from the XML and using an offset/match formula...  however, when I do that the data from the xml file loses it's formatting even though it looks right in the sheet that I imported the file to.  

So instead of looking like the below...

url - xxxxxxx
gd - xxxxxxx
dt - xxxxxxx

The data comes in like this...

url - xxxxxxxgd - xxxxxxxdt - xxxxxxx


I am somewhat familiar with VBA, but am definitely a novice, so any help you can provide would be awesome!

Thanks!
Avatar of andrewssd3
andrewssd3
Flag of United Kingdom of Great Britain and Northern Ireland image

It looks as though the xml data is not being imported correctly with the different elements in separate cells. It would really help if you could post an example of your xml file and the workbook you are using to import it it to. You should not have to use VBA for this provided your import splits up the data correctly.
On a different tack, if you are exporting xml data from Access, could you not export it in Excel format, or csv, which may be easier to handle?
Avatar of rsburge

ASKER

Thank you for your feedback.
Let me look into the excel export.  The original reason we didn't do that is because it was truncating the data from the memo field and the only way to get around that was to do an xml export.

The data in the two fields is combined using VBA and the VBA inserts the vbcrlf to get the next line in the cell.

Originally it was going from Access to another access database on another system.

Now, several of the users do not have Access, so the next solution that they are willing to work with is an Excel spreadsheet.

I am not able to post the xml file because it contains usernames and passwords.
OK - but I can't help without at least seeing the structure of the file - could you just post a section with sensitive data removed?
Avatar of rsburge

ASKER

Attached is a sample of the xml, and the workbook sample.  

The Import tab is what the data looks like when I just do a straight import of the xml.

The Login tab is what the data looks like when I use the offset/match formula to pull the data in from the import tab.  You can see the data looks correct in the Import tab, but when the formula pulls it in, it is in a single line; I need it to stay formatted as it is in the Import tab.

Ultimately, when this is all complete, the user will be able to click on the lender name in the Active Lenders tab that will take them to the matching row on the Logins tab.  I think I know how to do this piece however, I may end up asking a new question if it doesn't work as I hope.

Thank you for your help.
xmlExportSample.xml
ExcelSample.xls
ASKER CERTIFIED SOLUTION
Avatar of andrewssd3
andrewssd3
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rsburge

ASKER

Oh my gosh...  now don't I feel really dumb.  :)

I can't believe I didn't check that.  I am usually REALLY good with Excel.

Thank you so much for catching this my mistake!
No it wasn't stupid - Excel automatically applies that formatting when you import or put a line feed in manually with alt-enter, but it doesn't know to do it when the data comes from a reference in a formula. It puzzled me for a while

Glad it's working now