# Update Shopify Inventory from CSV Files On Your FTP Server

6 min setup

No coding required

Runs automatically

Manually updating inventory from supplier spreadsheets is tedious and error-prone — and falling behind means overselling products you don't actually have. This workflow watches your FTP server for CSV files and automatically syncs inventory quantities to the right Shopify variants by SKU, on an hourly schedule. No copying, no pasting, no catching up. Just accurate stock counts without the manual work.

### How it works

4 steps to automatically update your Shopify inventory levels whenever a new CSV file lands on your FTP server

### Fetch CSV file from server

App connector: [FTP](/content/apps/ftp/integrate "View FTP  integration page"/index.html)• Time to complete: 2 minutes

**Why this matters:** This is what kicks off the entire workflow. Without a reliable trigger that reads your CSV correctly, no inventory updates happen downstream — so the file format and schedule you set here are foundational to everything else.

This step connects to your FTP server on an hourly schedule and reads the CSV file you specify. You'll configure two things: the file path (which supports _wildcards to match files like inventory/Stock_.csv) and whether the file should be moved after it's read. Your CSV must include at minimum a **SKU** column and an **Inventory** column — these are required for the workflow to function. Once the file is read, each row gets passed into the next step as individual records.

- **File path field:** Enter the path to your CSV file (e.g., inventory/Stock*.csv)
- **Move file after reading:** Leave this off unless you want the file removed from the server after each run
- **Schedule:** Runs every hour by default — adjust in MESA if you need a different cadence

### Loop over rows in CSV file

App connector: [Loop](/content/apps/loop/integrate "View Loop  integration page"/index.html)• Time to complete: 0 minutes (Auto-configured)

**Why this matters:** Your CSV likely has dozens or hundreds of SKUs — this step makes sure each row is processed individually rather than all at once, which prevents errors and keeps inventory updates accurate per product.

The Loop step iterates through every row in the CSV file fetched in Step 1, processing one SKU at a time. Each iteration carries that row's SKU and Inventory values forward into the next steps. No configuration is needed here — MESA automatically knows to loop over the CSV data from the trigger. If your CSV has 200 rows, this step runs the following steps 200 times.

### Retrieve Product Variant Details from SKU

App connector: [Code](/content/apps/custom/integrate "View Code  integration page"/index.html)• Time to complete: 0 minutes (Auto-configured)

**Why this matters:** Shopify's inventory system works with variant IDs, not SKUs — this step bridges that gap by looking up the correct variant for each row, so the inventory update in the next step lands on the right product.

For each CSV row processed by the Loop, this step takes the SKU value and queries Shopify to find the matching product variant. It returns the variant's ID, which is required to set inventory in the next step. This lookup runs automatically using the SKU from each loop iteration — no configuration is needed. If a SKU in your CSV doesn't match any variant in Shopify, this step will surface an error for that row so you can identify mismatches.

### Set Inventory Level By Variant

App connector: [Shopify](/content/apps/shopify/integrate "View Shopify integration page"/index.html)• Time to complete: 2 minutes

**Why this matters:** This is where the actual inventory number gets written to Shopify. You need to specify the correct store location here — if the wrong location is selected, inventory will update in the wrong place and your stock counts won't reflect reality.

This step sets the available inventory quantity in Shopify for the variant retrieved in Step 3, using the inventory number from the corresponding CSV row. The variant ID is passed in automatically, but you must configure one field: your store's **Location ID**. To find your Location ID, go to **Shopify Admin → Settings → Locations**, select the correct location, and copy the ID from the URL. Make sure the location is enabled before saving.

- **Location ID field:** Paste your Shopify location ID (e.g., 12345678)
- **Available quantity:** Pulled automatically from the CSV's Inventory column

## Frequently asked questions

### What happens if a SKU in the CSV doesn't exist in Shopify?

The custom code step logs that the SKU wasn't found and stops processing that row without updating anything. The workflow continues to the next CSV row. Check your MESA logs to see which SKUs failed to match if you suspect missing products.

### Can I use this to update inventory at multiple locations?

This workflow updates inventory at a single location specified in the "Set Inventory Level" step. To update multiple locations, either run separate workflows configured for each location, or add a "Location" column to your CSV and modify the logic to use that value instead of a hardcoded location ID.

### Does this workflow adjust inventory or set it to an absolute value?

The workflow uses Shopify's "set" endpoint, which sets inventory to the exact quantity from the CSV regardless of the current value. If your CSV says "10" and Shopify currently shows "15," it will change to "10." This ensures your CSV is always the source of truth but doesn't create an adjustment audit trail.
