Skip to content

Commit 20cce06

Browse files
committed
docs: wildcard path with headers
1 parent a1d125f commit 20cce06

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,33 @@ $loader->inFile(database_path('files/users.csv'))
170170
->execute();
171171
```
172172
173+
### Wildcard Path with Headers
174+
175+
When using a wildcard path, the first file is assumed to contain the headers. The succeeding files should not have headers or it will be reported as a bad record.
176+
177+
```php
178+
$loader->inFile(database_path('files/*.csv'))
179+
->withHeaders()
180+
->mode(Yajra\SQLLoader\Mode::TRUNCATE)
181+
->into('employees')
182+
->execute();
183+
```
184+
185+
- employees-1.csv
186+
187+
```csv
188+
name,dept_id
189+
John Doe,1
190+
Jane Doe,2
191+
```
192+
193+
- employees-2.csv
194+
195+
```csv
196+
John Doe,1
197+
Jane Doe,2
198+
```
199+
173200
### Connection
174201
175202
You can set the connection name to use for the SQL*Loader command using the `connection` method.

0 commit comments

Comments
 (0)