Categories > OpenTBS with XLSX >

multidimensional array export to excel

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: new2TBS
Date: 2013-07-31
Time: 17:17

multidimensional array export to excel

Dear friends

This is duplicate of
http://www.tinybutstrong.com/forum.php?thr=3184

apologies for posting in wrong forum earlier. Now its in correct category.

I want to export below array to excel.
I tried suggestion posted here in forum but with no success.

Array
(
    [2008] => Array
        (
            [B1] => Array
                (
                    [D1] => Array
                        (
                            [jan] => 100
                            [feb] => 200
                            [mar] => 300
                            [apr] => 400
                            [may] => 100
                            [jun] => 150
                        )

                    [D2] => Array
                        (
                            [jan] => 150
                            [feb] => 210
                            [mar] => 210
                            [apr] => 158
                            [may] => 142
                            [jun] => 120
                        )

                )

        )

    [2009] => Array
        (
            [B1] => Array
                (
                    [D1] => Array
                        (
                            [jan] => 100
                            [feb] => 200
                            [mar] => 300
                            [apr] => 400
                            [may] => 100
                            [jun] => 150
                        )

                    [D2] => Array
                        (
                            [jan] => 150
                            [feb] => 210
                            [mar] => 210
                            [apr] => 158
                            [may] => 142
                            [jun] => 120
                        )

                )

            [B2] => Array
                (
                    [D1] => Array
                        (
                            [jan] => 100
                            [feb] => 200
                            [mar] => 300
                            [apr] => 400
                            [may] => 100
                            [jun] => 150
                        )

                    [D2] => Array
                        (
                            [jan] => 150
                            [feb] => 210
                            [mar] => 210
                            [apr] => 158
                            [may] => 142
                            [jun] => 120
                        )

                )

        )

    [2013] => Array
        (
            [B1] => Array
                (
                    [D1] => Array
                        (
                            [jan] => 100
                            [feb] => 200
                            [mar] => 300
                            [apr] => 400
                            [may] => 100
                            [jun] => 150
                        )

                    [D2] => Array
                        (
                            [jan] => 150
                            [feb] => 210
                            [mar] => 210
                            [apr] => 158
                            [may] => 142
                            [jun] => 120
                        )

                )

        )

)

I cannot attach the image, so giving html
<table width="100%" border=1>
<tr>
  <td>Year</td>
  <td>branch</td>
  <td>division</td>
  <td>jan</td>
  <td>feb</td>
  <td>mar</td>
  <td>apr</td>
  <td>may</td>
  <td>jun</td>
</tr>

<tr>
  <td rowspan="2">2008</td>
  <td rowspan="2">B1</td>
  <td>D1</td>
  <td>100</td>
  <td>200</td>
  <td>300</td>
  <td>400</td>
  <td>100</td>
  <td>150</td>
</tr>

<tr>
  <td>D2</td>
  <td>150</td>
  <td>210</td>
  <td>210</td>
  <td>158</td>
  <td>142</td>
  <td>120</td>
</tr>

<tr>
  <td rowspan="4">2009</td>
  <td rowspan="2">B1</td>
  <td>D1</td>
  <td>100</td>
  <td>200</td>
  <td>300</td>
  <td>400</td>
  <td>100</td>
  <td>150</td>
</tr>

<tr>
  <td>D2</td>
  <td>150</td>
  <td>210</td>
  <td>210</td>
  <td>158</td>
  <td>142</td>
  <td>120</td>
</tr>
<tr>
  <td rowspan="2">B2</td>
  <td>D1</td>
  <td>100</td>
  <td>200</td>
  <td>300</td>
  <td>400</td>
  <td>100</td>
  <td>150</td>
</tr>

<tr>
  <td>D2</td>
  <td>150</td>
  <td>210</td>
  <td>210</td>
  <td>158</td>
  <td>142</td>
  <td>120</td>
</tr>

</table>

would you please guide me on how to achieve this. also need total per year and branch.

In excel, i used below

[a.finyr;block=row;sub1] [b.scid;block=row;p1=[fd.$];p2=[a.finyr] ]

Thanks in advance
By: Anonymous
Date: 2013-08-01
Time: 15:52

Re: multidimensional array export to excel

any help please
By: Skrol29
Date: 2013-08-20
Time: 23:55

Re: multidimensional array export to excel