import_and_export:import_items_and_stock

Action unknown: copypageplugin__copy

17.02. Importing stock

We strongly recommend:

* You take a backup of your datafile before attempting any imports.
* You test any import on a copy of your data before you do it on the real data.

Don't say you haven't been warned ;-)

The Import stock function allows you to import stock into a store after the items have been created (manually or by using the item import function).

Choose File > Import > Import stock from the menus. You will be shown a warning:

This is telling you to take care! The stock you are importing will be imported on top of the stock you already have in the store you are currently logged into. If you are not sure what you are doing, stop and make sure!

After clicking the OK button you will be told the next step is to select the import file:

Click the OK button on this window and an operating system window will open for you to select the import file. Find the file and double-click on it or click on it and click the Open button.

This window will open:

  • First line contains column headers checkbox: Check this by clicking on it if the first line of your file contains the column headers. If this checkbox is checked, mSupply will ignore the first row of the import file and only import from the second row onwards.
  • Remove quote characters on import checkbox: Check this if you want mSupply to remove quote () characters from the various fields as it does the import. This is often needed if your import file has come from Excel or another spreadsheet application. You can check if there are unwanted quote characters in the fields using the preview Next and Previous buttons (see below).
  • Next and Previous buttons: Use these to move through the rows in the import file. mSupply will show you the information is is going to import from each field in the import file. You will be shown a warning if you try to view lines before the start or after the end of the file.

If you spot any problems, click on the Cancel button, fix them and try again. If all is well, click on the Import button and mSupply will carry out the import. A progress bar will show you how far through the whole process mSupply is. When it gets to the end you will be shown a message telling you how many lines were imported successfully and how many were skipped (because the item could not be identified - because the item code was missing or did not match an item in your datafile).

  • The import file must be a tab delimited text file.
  • The first row can contain the column titles but all other rows in the file should contain data to be imported.
  • The table below details the fields you should have (and the order they must be in) in each row of the file.
Column Field Description
1 (A) Item code Mandatory, Text, up to 18 characters. mSupply uses this to recognise which item this row of stock belongs to. If this code is missing or does not belong to an item already in your datafile, this line of the import file will be skipped.
2 (B) Item name Optional, ignored during the import. Text, up to 80 characters. The name of the item, here for reference so you can easily tell which item each row refers to.
3 (C) Units Optional, ignored during the import. Text up to 60 characters, for your reference only. The unit the item is to be measured in e.g. Tablet, Each, ml, g, bottle, vial, Ampoule.
4 (D) Pack size Mandatory, Integer. The number of units in a single pack for this stock line.
5 (E) Quantity Mandatory, Integer. The number of packs (containing the number of units in column 4) in this stock line. Equal to the total quantity if the Pack size is 1.
6 (F) Cost price Optional, Real number. The price you pay for one pack.
7 (G) Sell price Optional, Real number. The price the customers of this store pay for one pack. Set this to the same as the cost price or leave it empty if you do not actually sell the stock that you issue.
8 (H) Batch Optional, Text, Up to 20 characters. The batch of this stock line.
9 (I) Expiry Optional, Text, in short format (dd/mm/yy or mm/dd/yy, depending on the format set in your computer's operating system). The date this stock line will expire.
10 (J) Description Optional. Text, Up to 32,000 characters. The full description of the item. Be careful not to have any carriage return characters in the text though, or the import file will not be valid!
11 (K) Item Department Optional, Text, up to 30 characters. If you import a department name that doesn't exist, the department will be created.
12 (L) Shelf Location Optional, Text, Up to 60 characters. The code for the shelf location of this stock line.
If the location does not exist, the location will be created as the stock is loaded. You can then edit the location details after the import.
13 (M) Donor Optional, Text, Up to 60 characters. The name of the donor of this stock line. If the donor doesn't exist, it will be created.
14 (N) Custom stock field 5 Optional, Text. The value to be entered in custom stock field 5 for this batch. If the value doesn't already exist as an option for custom stock field 5 then it will be added. See the 7.05. Custom stock fields page for details of custom stock fields.
15 (O) Outer pack size Optional, Integer. The number of packs that fit in a carton (NOT the number of units in a carton!).
16 (P) Volume per pack Optional, Decimal number. The volume that a single pack of this batch occupies on the shelf in m3.
17 (Q) Weight per pack Optional, Decimal number. The weight of a single pack of this batch in kg.

Please note: It is not part of the import file but, if an item's default Volume per pack is set (see the Volume per pack field on the 4.01.02. Items - Storage tab page for details) then this will be applied to the stock line's volume per pack. The value will be proportionately increased or decreased if the stock line's pack size differs from the item's default pack size (Preferred pack size field on the 4.01.02. Items - Storage tab page).

Here is a blank spreadsheet you can use with the right columns: msupply_stock_import.xlsx

Note: the first row of data in red is an example row - delete it before you import it!

You can create the import file in various ways:

  1. Manually using the blank template above.
  2. Manually using any text editor.
  3. Export the current stock from a store in this or another mSupply datafile (and modify it if necessary) and import that.

If you use a spreadsheet application like Excel remember to export the file in Tab delimited text format before trying to import it into mSupply.

You can import as many batches of an item as you wish, there is no limit. And it doesn't matter whether batches of the same item are next to each other in the import file.



  • Last modified: 2023/04/21 03:10
  • by Mark Glover