xmlsquad / gsheet-to-xml

Given the url of a Google Sheet, this Symfony Console command fetches the Google Sheet and outputs it in the form of Xml.
Apache License 2.0
3 stars 1 forks source link

User Story: Allow a few lines of blurb at the top of Inventory sheets #14

Open forikal-uk opened 6 years ago

forikal-uk commented 6 years ago

Note this is PHASE 2 - So there is no need to implement this now.

Story:

As the (non-IT oriented) author of Inventory Google Sheets, I can add a title and, maybe, some descriptive text above the data in the Google Sheet, because I don't think of the spreadsheets as data, I think of them as documents.


Behaviours

We can detect a 'header row', and only from that point onwards, could it assume that the next rows contain data. This would allow blurb at the top to be ignored and therefore suppress errors caused by that blurb.

The following set of values which, if present in any order on one row, indicate the row is a header row:

 Notes

If we do add a title in the rows above the data rows like so:

screen shot 2018-06-03 at 01 53 55

We get some errors:

$ php bin/gsheet-to-xml.php  --credentials="../../../../APIKeys/gsheet-to-xml-e5eaf708560f.json" https://docs.google.com/spreadsheets/d/1W0OSpY34qIoG1M6TXkSB2OsXg3SM-Bf9AeJKtVbw-WM/edit#gid=311423522

Warning: array_combine(): Both parameters should have an equal number of elements in /Users/jw/Documents/Projects/XmlAuthoring/gsheet-to-xml/src/Application/Service/GoogleSpreadsheetReadService.php on line 107

Warning: array_combine(): Both parameters should have an equal number of elements in /Users/jw/Documents/Projects/XmlAuthoring/gsheet-to-xml/src/Application/Service/GoogleSpreadsheetReadService.php on line 107

Warning: array_combine(): Both parameters should have an equal number of elements in /Users/jw/Documents/Projects/XmlAuthoring/gsheet-to-xml/src/Application/Service/GoogleSpreadsheetReadService.php on line 107

Warning: Invalid argument supplied for foreach() in /Users/jw/Documents/Projects/XmlAuthoring/gsheet-to-xml/src/Model/InventoryFactory.php on line 31

Warning: Invalid argument supplied for foreach() in /Users/jw/Documents/Projects/XmlAuthoring/gsheet-to-xml/src/Model/InventoryFactory.php on line 31

Warning: Invalid argument supplied for foreach() in /Users/jw/Documents/Projects/XmlAuthoring/gsheet-to-xml/src/Model/InventoryFactory.php on line 31
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Products>
  <Product>
    <Inventory src-sheet="_GoodSheet-Phase2" src-sheet-url="https://docs.google.com/spreadsheets/d/1W0OSpY34qIoG1M6TXkSB2OsXg3SM-Bf9AeJKtVbw-WM/edit#gid=311423522" src-tab="InventoryTabA">
      <StockItem>
        <KNumberExists></KNumberExists>
        <KNumber></KNumber>
        <AdditionalKNumbers></AdditionalKNumbers>
        <AlternativeNumber></AlternativeNumber>
        <InventoryContainerID></InventoryContainerID>
        <Name></Name>
        <Purposes>
          <Purpose></Purpose>
        </Purposes>
        <PurposeOther></PurposeOther>
        <InventoryQuantity></InventoryQuantity>
        <HandlingStatus></HandlingStatus>
        <SupplierRegistrationNumber></SupplierRegistrationNumber>
      </StockItem>
      <StockItem>
        <KNumberExists></KNumberExists>
        <KNumber></KNumber>
        <AdditionalKNumbers></AdditionalKNumbers>
        <AlternativeNumber></AlternativeNumber>
        <InventoryContainerID></InventoryContainerID>
        <Name></Name>
        <Purposes>
          <Purpose></Purpose>
        </Purposes>
        <PurposeOther></PurposeOther>
        <InventoryQuantity></InventoryQuantity>
        <HandlingStatus></HandlingStatus>
        <SupplierRegistrationNumber></SupplierRegistrationNumber>
      </StockItem>
      <StockItem>
        <KNumberExists></KNumberExists>
        <KNumber></KNumber>
        <AdditionalKNumbers></AdditionalKNumbers>
        <AlternativeNumber></AlternativeNumber>
        <InventoryContainerID></InventoryContainerID>
        <Name></Name>
        <Purposes>
          <Purpose></Purpose>
        </Purposes>
        <PurposeOther></PurposeOther>
        <InventoryQuantity></InventoryQuantity>
        <HandlingStatus></HandlingStatus>
        <SupplierRegistrationNumber></SupplierRegistrationNumber>
      </StockItem>
    </Inventory>
  </Product>
  <Product>
    <Inventory src-sheet="_GoodSheet-Phase2" src-sheet-url="https://docs.google.com/spreadsheets/d/1W0OSpY34qIoG1M6TXkSB2OsXg3SM-Bf9AeJKtVbw-WM/edit#gid=311423522" src-tab="InventoryTabB">
      <StockItem>
        <KNumberExists>true</KNumberExists>
        <KNumber>5555555</KNumber>
        <AdditionalKNumbers></AdditionalKNumbers>
        <AlternativeNumber></AlternativeNumber>
        <InventoryContainerID></InventoryContainerID>
        <Name>baz</Name>
        <Purposes>
          <Purpose>5</Purpose>
        </Purposes>
        <PurposeOther></PurposeOther>
        <InventoryQuantity>55</InventoryQuantity>
        <HandlingStatus></HandlingStatus>
        <SupplierRegistrationNumber></SupplierRegistrationNumber>
      </StockItem>
      <StockItem>
        <KNumberExists>false</KNumberExists>
        <KNumber></KNumber>
        <AdditionalKNumbers></AdditionalKNumbers>
        <AlternativeNumber>_GoodSheet &gt; InventoryTabB</AlternativeNumber>
        <InventoryContainerID></InventoryContainerID>
        <Name>bar</Name>
        <Purposes>
          <Purpose>5</Purpose>
        </Purposes>
        <PurposeOther></PurposeOther>
        <InventoryQuantity>55</InventoryQuantity>
        <HandlingStatus></HandlingStatus>
        <SupplierRegistrationNumber></SupplierRegistrationNumber>
      </StockItem>
    </Inventory>
  </Product>
</Products>