bg

USB Barcode Scanner to Excel: Log Every Scan With a Timestamp (Keyboard Mode)

Most USB barcode scanners work as a keyboard: every scan is typed into whatever window is in front, followed by Enter. That is enough for a quick list, and the barcode scanner to Excel guide shows the two-minute setup. It stops being enough when the codes must go into a sheet that is not in front, when every scan needs a date and time, when several scanners feed one sheet, or when a log file has to exist next to the spreadsheet, when it should work in backgroud, when a scanner code should be reformatted, etc. USB HID Logger reads the scanner directly, as a USB HID device, so Excel can stay minimised or even run on another computer.

1. Prepare the scanner

  1. Plug the scanner in. Windows needs no driver for keyboard mode; the scanner appears in Device Manager under Keyboards or Human Interface Devices.
  2. Make sure the scanner adds a terminator after each code. Scan the "Add Enter" (carriage return) setup barcode from the scanner's manual. The logger uses that character to separate one code from the next.
  3. Scan a code into Notepad once. If it appears as expected, the scanner side is done.

2. Add the scanner to USB HID Logger

2. Create a new configuration and select necessary USB HID devices from a list. If your USB device is not plugged yet, connect it temporarily before creating the configuration (fig. 1).

Fig. 1 Selecting a USB device

Fig. 1 Selecting a USB device

3. Select the following options:

check
Fig. 2 Selecting a logging mode

Fig. 2 Selecting a logging mode

4. In the same configuration, enable the option that groups keystrokes into a line of characters. The program reads the scanner's keyboard reports one key at a time; this option collects them until the terminator arrives and hands over the whole code. It was added for barcode and RFID scanners in keyboard mode and is off for other HID devices.

5. Click OK. Scan a few codes: each one appears as a separate line in the main window.

USB HID Logger main window with one barcode per line

Fig. 3 Scanned codes in the main window

3. Add a timestamp and a log file

Open the configuration again and go to the log file settings. Enable the log file for received data and switch on the date and time stamp, so that every scan is written as one line with the moment it was read. The file can be rotated by day or by size, which keeps a permanent record independent of what happens to the spreadsheet.

USB HID Logger log file settings with date and time stamps

Fig. 4 Log file with date and time stamps

4. Send the codes to Excel

There are two ways, and they can run at the same time.

  • CSV file for Excel. Enable writing the received data to a log file in the CSV format (fig. 5). The file opens in Excel with one row per scan: date, time, code. This is the simplest way when the sheet is filled in once a day or once a shift. The USB to Excel tutorial describes the file options.
  • Live export. Select the Excel export in the data export plugins (fig. 6) to put every code into the next row of an open workbook as it is scanned, or use the DDE server to feed a formula in a cell. Excel does not have to be the active window for this to work, and it can be a workbook on another computer that reads the CSV from a shared folder.
Configuring the CSV log file for Excel

Fig. 5 CSV log file for Excel

Selecting the data export plugin

Fig. 6 Data export plugins

Note 1. The log folder must be writable. Do not write to the root of drive C:, to Program Files or to the Windows folder; since Windows Vista only the administrator can write there.

Note 2. When the program runs as a Windows service, the service account has restricted rights to create files; give it a folder of its own.

5. Check the result

Scan a code with Excel minimised. The line appears in the main window with its timestamp, the log file grows by one row, and the workbook or CSV file gets the new row. If the code comes in as single characters instead of one line, the terminator is missing: scan the "Add Enter" setup barcode again and check step 2.4.

Variations

  • Several scanners. Add each scanner as its own configuration; each can log to its own file and to its own column or sheet, or all of them to one sheet with the device name in a column.
  • Clean up the code first. The data filter can cut a prefix, keep only the digits, or reject codes of the wrong length before the export, so the sheet never needs a formula for that.
  • Scanner with a COM port. A scanner that appears as COM port (RS232, Bluetooth SPP, USB in virtual-COM mode) does not type anything. Use Advanced Serial Data Logger instead: process data from a barcode scanner and log every scan with a timestamp.
  • Database instead of Excel. The same configuration can write to a database, MS SQL Server or MySQL.
  • Play a sound for evert processed barcode. The event notification plugin can play any WAV file when for the "NEW-DATA-PACKET" event generated automatically in the program.

Video transcript

Narration of the video "USB barcode scanner to Excel" (September 2026).

A USB barcode scanner works like a keyboard: every scan is typed into the window in front. Here is the quick way into Excel, where it breaks down, and how USB HID Logger records every scan with a timestamp while Excel stays in the background.

Keyboard mode. Format the column as Text first, or Excel turns a 13-digit code into a number. Click the first cell and scan: each code lands in a cell, and Enter moves down a row. The catch: the keystrokes go wherever the cursor is. Click into another program, scan, and the code lands there. There is no timestamp either, and nothing is saved until you save.

USB HID Logger. USB HID Logger reads the scanner directly from the USB bus. Nothing is typed anywhere. Every scan is stamped, written to a log file, and handed to Excel. Click the green plus and tick the scanner in the list of HID devices. It shows up as a keyboard, usually under the maker's name. On the Options page keep logging decoded data, and enable the option that collects the keys of one scan into a line, so one scan becomes one line. OK. Scan a few codes. Each one appears as a line in the main window, and Excel is not touched. Open the log file settings from the toolbar. Choose the CSV file type, enable the log file, and set a folder you may write to. OK. Two more scans. Each line on the screen carries the date and time, and the CSV file grows by one row per scan.

Into Excel. Open that file in Excel: one row per scan, with the device and the code. Fill the sheet once a shift, or keep the file on a shared folder. For a live sheet, the data export modules write every code straight into the next row of an open workbook, or serve it to a formula through DDE. Databases work the same way. Several scanners: each gets its own configuration and its own file or column. A prefix to cut or a length to check: the data filter does it before the export. A scanner with a COM port is a job for Advanced Serial Data Logger. The written guide with every dialog is on aggsoft.com. Thanks for watching.

Related articles: USB Barcode Scanner to Excel: Log Every Scan With a Timestamp (Keyboard Mode)

Related topics: USB HID Logger

here

USB HID Logger USB Port Monitor