Plenty Article Create on Change¶
This Google Apps Script automates the creation of articles in PlentyMarkets when a specific trigger phrase is entered into a Google Sheet.
Overview¶
- Script Name:
Plenty_article_create_on_change.gs - Trigger: Edit event in the spreadsheet.
- Trigger Column: Column N (Index 14).
- Trigger Phrase: "Plenty anlegen" (case-insensitive, spaces ignored).
- Target API:
https://dashboard.lage-beauty.de/plenty/articles/create/article
How it Works¶
- Event Detection: The script listens for an "On edit" event.
- Validation:
- Checks if the edit occurred in the correct column (Column N).
- Checks if the entered value matches "Plenty anlegen".
- Data Collection:
- Retrieves the entire row of data where the edit occurred.
- Maps the row values to the header names (first row) to create a data object.
- API Request:
- Sends a POST request to the configured API endpoint.
- Payload includes the spreadsheet ID, sheet ID, row index, and the row data.
- Feedback:
- Updates the cell to "Plenty angelegt" on success.
- Updates the cell to "API error" or "script error" on failure.
- Shows a toast notification in the spreadsheet UI.
Configuration¶
- API URL: Currently set to
https://dashboard.lage-beauty.de/plenty/articles/create/article. - Token: Uses a hardcoded token for authentication with the API.
Usage¶
To trigger the script:
- Fill in the article details in a row.
- In Column N of that row, type "Plenty anlegen".
- Wait for the cell to update to "Plenty angelegt".