Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 2.13 KB

DOCUMENTATION.md

File metadata and controls

56 lines (39 loc) · 2.13 KB

Installation

  • Clone this project
  • Run composer install
  • test the console app: php bin/gsheet-to-xml.php --help

Note Make sure you're using at least PHP 7.1

Google API Setup

See: How to: Google API Setup

Usage

php bin/gsheet-to-xml.php {URL} [--credentials=client_secret.json] [--recursive]

{URL} should be either Drive or Sheets URL in one of following formats

-c, --credentials is optional parameter that specifies path to the credentials file with Google secret. Path must be relative to the directory you're calling the script from.

-r, --recursive if the Google Drive entity is a Google Drive folder, this option specifies whether or not to recurse through sub-directories to find sheets.

Behavior

  • Empty rows are skipped without notice.
  • Files ending with _ (underscore) are ignored (e.g. foo_.xslx, foo_)
  • Tabs ending with _ (underscore) are ignored
  • When parsing folders, for every spreadsheet found new <Product><Inventory> XML element is created with src-sheet-url attribute containing the spreadsheet ID.

Tests

If the package is being edited in standalone context: Run ./vendor/bin/phpunit to execute test suite

If the package is being edited in context of some other parent project you could run phpunit from the root directory and point to this package's tests folder explicitly:

$ pwd
/some/parent/project/root/folder
$ ./vendor/phpunit/phpunit/phpunit vendor/xmlsquad/gsheet-to-xml/tests/

Resources

Troubleshooting

  • You have to enable both Sheets and Drive API
  • You have to share files/folders with email in credentials JSON file