Skip to content

Instantly share code, notes, and snippets.

@dinarcon
Created August 21, 2019 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dinarcon/23cfd4fe6cc71e3c0f829c1a02a8a1d2 to your computer and use it in GitHub Desktop.
Save dinarcon/23cfd4fe6cc71e3c0f829c1a02a8a1d2 to your computer and use it in GitHub Desktop.
process:
psf_destination_filename:
plugin: callback
callable: basename
source: B # This is the photo URL column.
destination:
plugin: 'entity:file'
source:
plugin: spreadsheet
file: modules/custom/ud_migrations/ud_migrations_sheets_sources/sources/udm_photos.xlsx
worksheet: 'UD Example Sheet'
# The file does not have a headers row.
header_row: null
origin: A1
# If no header row is available, you use the spreadsheet's column names: A, B, C, etc.
# If you do not manually add a list of columns, all columns that contain data in the worksheet would be returned.
# The same names need to used in the process section.
columns:
- A # This column contains the photo ID. Example: 'P01'.
- B # This column contains the photo URL.
row_index_column: null
keys:
A:
type: string
process:
field_ud_book_paragraph_title: book_title
field_ud_book_paragraph_author: 'Book author'
destination:
plugin: 'entity_reference_revisions:paragraph'
default_bundle: ud_book_paragraph
source:
plugin: spreadsheet
file: modules/custom/ud_migrations/ud_migrations_sheets_sources/sources/udm_book_paragraph.ods
worksheet: 'UD Example Sheet'
header_row: 1
origin: A2
columns:
- book_id
- book_title
- 'Book author'
row_index_column: 'Document Row Index'
keys:
book_id:
type: string
book_id book_title Book author
B10 The definite guide to Drupal 7 Benjamin Melançon et al.
B20 Understanding Drupal Views Carlos Dinarte
B30 Understanding Drupal Migrations Mauricio Dinarte
P01 https://agaric.coop/sites/default/files/pictures/picture-15-1421176712.jpg
P02 https://agaric.coop/sites/default/files/pictures/picture-3-1421176784.jpg
P03 https://agaric.coop/sites/default/files/pictures/picture-2-1421176752.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment