Results 1 to 10 of 25

Thread: Need help to convert Excel data to XML

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Feb 2021
    Posts
    12
    Rep Power
    0
    Hi Alan,

    Did you get a chance to look into it? I had shared bigger image as you mentioned.

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Quote Originally Posted by uakash7 View Post
    Hi Alan,
    Did you get a chance to look into it?.
    Hi
    Sorry, I know nothing about XML
    If you can establish some consistent pattern between
    _ what you get
    and
    _ what you want
    then we might be able to develop some VBA solution to do a conversion.
    But I have no idea if such a way of doing something relatzred to XML stuff is any use, or sensible, due to my total lack of knowledge about anything at all to do with XML
    I don’t even have a clue what XML is. It seems to be some way of storing and transferring data, but I have never done anything with it.

    Alan
    Last edited by DocAElstein; 02-15-2021 at 04:07 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

  3. #3
    Junior Member
    Join Date
    Feb 2021
    Posts
    12
    Rep Power
    0
    Hi Alan,

    For now just forget about XML and help me to print data from excel file to text file in a different format -

    Data is Excel file

    Code:
    Entity ID	day	month      year	time	
    700		19	2	       2021	8:00	
    700		19	2	       2021	8:30	
    700		20	2	       2021	9:00	
    701		19	2	       2021	9:30
    Entity ID day month year time
    700 19 2 2021 8:00
    700 19 2 2021 8:30
    700 20 2 2021 9:00
    701 19 2 2021 9:30

    _____ Workbook: Sample excel file.xls ( Using Excel 2007 32 bit )
    Row\Col
    A
    B
    C
    D
    E
    F
    1
    Entity ID day month year time
    2
    700
    19
    2
    2021
    08:00
    3
    700
    19
    2
    2021
    08:30
    4
    700
    20
    2
    2021
    09:00
    5
    701
    19
    2
    2021
    09:30
    6
    Worksheet: Sheet1

    Just print this in a text file, starting from first row in excel file -

    #STEP 1 Start

    Print #intFile, "<Forecast>"
    Print #intFile, "<Entity>" & Entity ID & "</Entity>"

    #STEP 2 Start
    Print #intFile, "<Data>"
    Print #intFile, "<date>"
    Print #intFile, "<day>" & day & "</day><month>" & month & "</month><year>" & yeear & "</year></date>"

    #STEP 3 START

    Print #intFile, "<time>" & time & "</time>"

    #STEP 3 END

    Print #intFile, "</data>"

    STEP 2 END

    Print #intFile, "</forecast>"

    STEP 1 END

    Check
    if Entity ID in first row = Entity ID in 2nd row and date in first row = date in 2nd row then
    repeat STEP 3 for 2nd row and so on

    if Entity ID in first row = Entity ID in 2nd row and date in first row not equals to date in 2nd row then
    repeat STEP 3 for 2nd row and so on

    If Entity ID is not same as in previous row repeat STEP 1

    The output in text file should look like

    <forecast>
    <Entity>700</Entity>
    <data>
    <date>
    <day>19</day>
    <month>2</month>
    <year>2021</year>
    </date>
    <time>8:00</time>
    <time>8:30</time>
    </data>
    <data>
    <date>
    <day>20</day>
    <month>2</month>
    <year>2021</year>
    </date>
    <time>8:00</time>
    </data>
    </forecast>
    <forecast>
    <Entity>701</Entity>
    <data>
    <date>
    <day>19</day>
    <month>2</month>
    <year>2021</year>
    </date>
    <time>9:30</time>
    </data>
    </forecast>
    <forecast>

    Trying to help you to help me





    Alan testing....

    <forecast>
    <Entity>700</Entity>
    <data>
    <date>
    <day>19/<day>
    <month>2</month>
    <year>2021</year>
    </date>
    <time>08:00</time>
    <time>08:30</time>
    </data>
    <data>
    <date>
    <day>20/<day>
    <month>2</month>
    <year>2021</year>
    </date>
    <time>09:00</time>
    </data>
    </forcast>
    <forecast>
    <Entity>701</Entity>
    <data>
    <date>
    <day>19/<day>
    <month>2</month>
    <year>2021</year>
    </date>
    <time>09:30</time>
    </data>
    </forcast>
    Last edited by DocAElstein; 02-17-2021 at 07:20 PM.

Similar Threads

  1. Replies: 6
    Last Post: 09-24-2020, 10:36 AM
  2. XML Mapping in Excel Sheet
    By Ranjithkumar in forum Excel Help
    Replies: 1
    Last Post: 01-28-2014, 09:14 AM
  3. Xml Mapping in Excel Macro
    By dhivya.enjoy in forum Excel Help
    Replies: 1
    Last Post: 10-18-2013, 04:11 PM
  4. Convert selected file to XML and save.
    By dhivya.enjoy in forum Excel Help
    Replies: 7
    Last Post: 10-09-2013, 01:32 PM
  5. Replies: 0
    Last Post: 08-23-2012, 08:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •