Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions my_import
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Excel header -> Strapi attribute (api::member.member)
const FIELD_MAPPING = {
// Names + contact
"First \n": "firstName",
"Last Name": "lastName",
"Personal Email": "personalEmail",
"Dev Launchers Email": "devLaunchersEmail",

// Role & org
"Role": "role",
"Team": "team", // enum in schema
"Type": "Types", // enum in schema

// DocuSign / Discord / onboarding
"DocuSign\n": "docuSign", // enum in schema
"Discord Join Date (Start Date)": "discordJoinDate",
"Onboarding PackageSent": "onboardingPackageSent",
"OP Sent Date": "OPSentDate",
"Added on Discord": "addedOnDiscord",
"Discord": "discord",
"Discord Access": "discordAccess",

// GitHub / Google groups
"Added on Github": "addedOnGithub",
"Github": "github",
"GitHub Access": "githubAccess", // enum in schema
"Added to Google Groups": "addedToGoogleGroups",
"Google Suite Access": "GoogleSuiteAccess",

// Follow-up / onboarding complete
"2 Week FUP": "TwoWeekFup",
"Fully Onboarded Date": "FullyOnboardedDate",

// Status / tenure
"Status": "status", // enum in schema
"End Date (should this be moved to the Tenure tab?)": "EndDate",
"Duration active (months)": "DurationActiveMonths",
"Duration active (years)": "DurationActiveYears",

// Offboarding / notes
"Reason for leaving?": "ReasonForLeaving",
"Fully Offboarded Date": "FullyOffboardedDate",
"Note": "note"
};
55 changes: 55 additions & 0 deletions utility/member-import/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Member Import Utility

This folder contains standalone scripts for importing member data into the Strapi `members` collection.
It supports importing data from:

- **Local Excel (.xlsx) files**
- **Google Drive spreadsheet files** (via a Google Service Account)

These scripts handle:
- Data mapping from spreadsheet → Strapi fields
- Normalization (dates, booleans, enums, email formatting)
- Upsert logic (update if the member exists, otherwise create)
- Dry-run support
- Optional Google Drive link removal or file deletion

---

## 📁 Scripts Included

---

### **1. `import-members-local.mjs`**

Imports members from a **local Excel (.xlsx)** file defined in your `.env`.

#### 🛠 Setup

In your `.env`:

```env
STRAPI_URL="http://localhost:1337"
STRAPI_API_TOKEN="<your-token>"

LOCAL_XLSX_PATH="C:/path/to/members.xlsx" ```

BATCH_SIZE=10
DRY_RUN=false

#### 🛠 To Run Locally for downloaded Excel file

```
node import-members-local.mjs --dry

node import-members-local.mjs

```

#### 🛠 To Run for Googlesheets on google drive

```
node import-members-drive.mjs --dry

node import-members-drive.mjs

```
Loading
Loading