Download the PHP package aigorlaxy/google-sheets-model-importer without Composer
On this page you can find all versions of the php package aigorlaxy/google-sheets-model-importer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aigorlaxy/google-sheets-model-importer
More information about aigorlaxy/google-sheets-model-importer
Files in aigorlaxy/google-sheets-model-importer
Package google-sheets-model-importer
Short Description A simple trait to insert or update data to models from Google Sheets with just the link of the published spreadsheet. No need of Google API.
License MIT
Informations about the package google-sheets-model-importer
Google Sheets Model Importer
A simple Laravel support class to insert or update data to models from Google Sheets with just the link of the published spreadsheet. No need of Google API.
Installation
You can install the package via composer:
Using
-
Create a Google Spreadsheet.
-
Publish it to internet and set general access to anyone with the link can be a viewer.
-
Include the class in your model class and use it.
-
To create a instance of that class, you will need your target model, your googleSpreadSheetId and your specfic tab sheet2_gid.
-
To get your entire spreadsheet id using your published Google Sheets linkw The link will look something like that: https://docs.google.com/spreadsheets/d/e/YOU_GOOGLE_SHEET_SPREADSHEET_ID/something_else
-
To get your specific sheetId, follow this instructions: If you have just one tab for that model, use the gid as a string. If you have more than one tab for the same model, use array. All models must match the same column schema to work. The link will look something like that: https://docs.google.com/spreadsheets/d/YOUR_SPREADSHEET_ID/edit?gid=YOUR_SHEET_ID
-
Create a instance of the class.
-
Optional props 8.1. $updateColumnIndex: Optionaly you can set a different primary key to check for updates. if your primary key is not default id or you want to track updates based on another column. If not set, it will assume that id column is your primary key.
8.2. $colunsToSkip: You can also optionaly set columns to be skipped. The app will search for columns that contains any of that strings and will skip the import for that ones. You can set a single string or an array.
-
Example of usage:
- Any issue or suggestions, please send me an e-mail: [email protected]