Vba-Excel How to generate XML file from a SpreadSheet of Excel? - excel

I have been searching for the logic to convert the SpreadSheet data of an excel into XML format.
I have the thousands of data like shown below. i want to convert this into XML format.
Anyone please help me, any help would be appreciated greatly.

According to the screenshot, your Excel version allows to save your document using XML Spreadsheet 2003 format: Save As... > Other Formats and locate it in the dropdown (at least for Excel 2007 it works as described).
Resulting XML will contain much of the native Excel Workbook fields and nodes, but they're might be easily removed using any more or less advanced XML editor, e.g. Altova XMLSpy or any similar. However, cleanup depends entirely on your further needs.
For your convenience may see sample Excel book and XML generated from it as described above: https://www.dropbox.com/s/kxmxu2tq52y4m9b/ExcelToXML.zip
Good luck!

Related

Power Query to open XML file formatted as Excel would open it

I have an XML file generated by EasyPower (electrical software). If I open the file in Excel it comes up as a series of formatted sheets like the image below. It appears this way without any prompts or dialogs.
I’m creating a Power Query routine that can extract the data from the sheets. Unfortunately when I use the Power Query wizard to select the XML file as a source, it doesn’t see the data as sheets, but rather a table with columns of Tables, seemingly an infinite number of levels deep. Digging through them I’m unable to clearly see the data. This is not a very good approach.
A work-around is for me to manually open the XML file with Excel and save it as XLSX, then it’s easy to work with the data in Power Query. I know a VBA script could be used to this but my question is, is there a way for Power Query to open an XML file and interpret the layout the same way that Excel does? This way would allow my script to also work within Power BI.
Edit: A sample file has been requested. This link will provide a very simple example containing two worksheets when opened in Excel. EasyPower_Test_Schedule.xml

Column width style lose when converting .xls to csv

I am exporting an .xlsx document to .csv but I during that conversion I am loosing the complete style. Column width style is loosing terribly I was using Mac OS Numbers app but If i remember it correctly same issue happened with Microsoft excel ( I do not have the windows machine to cross check that for the moment).
original excel image
Exported csv image
I was wondering whether this is an application related issue or is it something wrong in general.
Did anyone face the same issue ? I do not have idea about where to begin to solve the styling issue. Some pointer will be greatly appreciated.
I added apache poi tag because I created the original excel using apache-poi
CSV stands for "Comma Separated Value".
CSV is a text file. Basically, you can open it with Excel or with a basic text editor. It is not made for storing formatting.
If you need to deal with formatted table then you have to choose another format.

Parsing excel data ( containing xml ) in VBA

I have a simple excel file containing rows and columns. One of the column contains rows of data which is string like this (XML data)
<Employee Name="R1" Designation="Developer">
<SkillSet Language="C#"/>
</Employee>
<Employee Name="E2" Designation="Developer">
<SkillSet Language="Java"/>
</Employee>
I would like to read this information in the excel file, parse it based on particular skillset and put them in the same excel workbook in adjacent column. I may need to provide a button click which may trigger the action.
How do I approach this problem.
Should I write a macro or should I write an excel addin. The excel can be either 2003 or earlier/2007/2010.
I can think of writing a user defined function to read the cell data but, how do I read through the columns in vb and also how do I re-use my function across different excel-workbooks.
Although this maybe coming to you at a late hour, however I had thesame problem as you mention. I'm also kind of new to VBA. My client wanted a database application in Access 2003. But after some persuation, I was able to convince them to adapt Access 2007. Which by the way, it's still not reliable, to develop a multi-lingual application.
Anyway to cut the story short, I was able to achieve same, after some google search and using the code I found here;
http://www.freevbcode.com/ShowCode.asp?ID=2922
and here
Parsing XML in VBA
Hope you find this links helpful cheers.
Add a reference (Tools-->References) to an XML parser, e.g., Microsoft XML, v6.0 -- my MS Access 2010 installation has a seven XML parsers provided by Microsoft. Declare an instance of the parser and use its properties and methods as you need.

Infopath to Excel through code

I would like to convert data from infopath form to excel spreadsheet through code.
I know you can export the data using the feature in infopath, but I am interested in doing this through code (like a part of a workflow).
Can anybody suggest a way for doing this or a possible starting point?
Thanks.
You can convert the xml data from the form to excel format.
Check this-XMl to Excel
Or, if you're looking for something more advanced, check out http://openxmldeveloper.org/

How do I save an Excel 2007 file in "OOXML" (xml text) so that I can modify it in code?

I made an Excel file with data on tab 2, and a chart on tab 1. This is for a web-portal where investors can download the excel document with ubber graphics and the like, but with their data.
So, the 'simple' fix in my mind is to save the Excel document as "OOXML" and just replace the data items. However, it seems that the document is encrypted (at least... not readable in notepad).
How do I get to where I need to go here?
Thanks,
Found my solution... using the Office Open XML SDK and googling / playing with it for a while.

Resources