Schedule MacroRIS-SM-2145 – Get Price

Get Price

Fetches stock, purchase price, and Amazon retail price for all SKUs, including composite items, generates a CSV report, and uploads it to an FTP server.

Overview

The RIS-SM-2145 – Get Price macro automates the extraction of SKU-wise purchase and selling prices and shares them via FTP for reporting or external system integration.

In simple terms:
It fetches SKU data, calculates purchase prices, retrieves retail prices, and automatically uploads a CSV to an FTP server.

Purpose

This macro:

  • Retrieves stock, purchase price, and retail price for all SKUs

  • Supports simple and composite (bundle) items

  • Generates a structured CSV report with pricing details

  • Uploads the CSV to a specified FTP server

  • Logs success or failure of the operation


When It Runs

Typically executed:

  • On daily or weekly schedules

  • Before marketplace price sync

  • During pricing audits

  • For integration with external systems


Parameters

path
ftpuserstring
Required

FTP username for authentication.

path
ftppassstring
Required

FTP password for authentication.

path
ftphoststring
Required

FTP server address.

path
ftpsslbool

Enable or disable secure FTP connection.

path
ftpportint

FTP server port.

path
ftpfolderstring
Required

Destination folder path for the CSV file.

These parameters are required to securely connect to the FTP server and upload the generated CSV file.


Simple Explanation

The macro:

  1. Retrieves SKU data including stock, quantity, and current prices

  2. Calculates purchase price for each SKU

  3. Combines component values for composite SKUs

  4. Generates a CSV file listing SKU, purchase price, retail price, and category

  5. Uploads the CSV file to a configured FTP server

This automates SKU price reporting for internal or external use.


Step-by-Step Process

Fetch Pricing Data

Retrieve SKU, stock value, quantity, and pricing information from inventory.

Calculate Purchase Price

Compute Purchase Price as Stock Value divided by Quantity. Ensure divide-by-zero errors are avoided.

Handle Composite Items

Aggregate component values to calculate total purchase price for bundle products.

Process Data

Ensure SKUs are valid, clean data, and format decimal values correctly.

Generate CSV File

Create a CSV file with columns: SKU, Purchase Price, Retail Price, and Category. Format values to two decimal places.

Prepare File Name

Format: QueryResults_YYYYMMDD_HHMMSS.csv for unique identification.

Upload to FTP

Connect to the FTP server using the provided credentials and upload the CSV file.

Logging & Error Handling

Log query execution, FTP upload status, and handle any errors safely.


Final Result

The macro generates and uploads a CSV file containing:

  • SKU – Stock Keeping Unit identifier

  • Purchase Price – Calculated cost per SKU

  • Retail Price – Selling price per SKU


Usefulness

  • Automated Reporting – Eliminates manual price extraction

  • Accurate Pricing – Supports both simple and composite items

  • Marketplace Ready – Data can be used for Amazon or other platform sync

  • Integration Friendly – FTP output for external system consumption


Example Scenario


Key Insight

This macro connects inventory and pricing data with external systems by automating extraction and sharing, ensuring accurate SKU prices, reducing manual effort, and preventing inconsistencies across marketplaces.