We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37042
    • 384 Posts
    A client has an excel sheet they use internally for managing listings. I had created a nice css styled table and they were copying and pasting info into my html table.

    However, they're finding this very time consuming as pre-modx they were using Adobe Contribute and could copy and past large selections of the Excel sheet into Contribute and it would strip out the dodgy html and formatting and convert it to a html table.

    Im looking into alternative ways of getting this data into a MODX recourse either such as saving excel as html table and then pasting table into resource

    Is there any other way to do this. IE have them upload a excel file via the manager and use some inbuilt MODX script to render the excel sheet as a table?

    Just fishing for ideas at the mo. Many thanks
      ...
      • 10208 ☆ A M B ☆
      • 1,780 Posts
      My thought is that you'd convert the client to saving as .csv output from Excel, and then upload .csv to a mySQL custom database in MODX. Either with phpMyAdmin or actually, the importX package would do the trick.

      Then, grab a pot of coffee and dig into xPDO and Custom DB tables at http://bobsguides.com/custom-db-tables.html for the output into your resource.
        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster
        • 16348
        • 64 Posts
        If you have the data stored in one custom db-table, you can use the Rowboat snippet to output the html-table. More info: http://modx.com/extras/package/rowboat
          • 37042
          • 384 Posts
          Thanks Frogabog and Kristoffer for the replies. Both are a bit technical for me but I think I've come up with a good solution for this which solves my problem.

          1. Copy cells from Excel
          2. Paste into the wonderful Excelt to HTML Table convertor here
          http://www.shancarter.com/data_converter/
          3. Convertor applies classes to the TDs which I can target in CSS
          4. Client can dump entire table then into a Resource once they are in HTML mode

            ...
            • 3749
            • 24,544 Posts
            There are some PHP classes out there that will read and parse Excel files, so in theory, you could write a snippet that would pull the current data directly into a MODX page with no importing or exporting. Here's one: http://phpexcel.codeplex.com/.

            That way the client could continue to manage the data in Excel and the MODX page would always be current.


            ------------------------------------------------------------------------------------------
            PLEASE, PLEASE specify the version of MODX you are using.
            MODX info for everyone: http://bobsguides.com/modx.html
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 22019
              • 390 Posts
              I may be missing something here, but I get my client to paste Excel straight into a RichText box, using the 'Paste from Word' function. They need to strip out the file name after it's done, but it generates a nice HTML table of data, that I can style accordingly.....
                Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
                • 37042
                • 384 Posts
                Hi odeclas

                I just tried that and indeed it does work but the drawback for me is that is applies widths to the table and columns as follows:

                <table style="width: 440px;" border="0" cellspacing="0" cellpadding="0"><colgroup><col width="81" /> <col width="60" /> <col width="177" /> <col width="122" /> </colgroup>


                With the Excel to HTML Table convertor, I can specify that the First row is the header and it handily applies corresponding class to each TD which I can then target more easily with some CSS


                <table>
                  <thead>
                    <tr>
                      <th class="Sport">Sport</th>
                      <th class="Time">Time</th>
                      <th class="Location">Location</th>
                      <th class="Match">Match</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr class="firstRow">
                      <td class="Sport-cell"></td>
                      <td class="Time-cell">Mon 16th</td>
                      <td class="Location-cell"></td>
                      <td class="Match-cell"></td>
                    </tr>
                </tbody>
                </table>
                  ...