i want to make a stock opname for our warehouse by scanning barcode of each items using scanner and save the result in google spreadsheet.
i have to scan 4 barcode (Item Number, Number1, Number2, IDBARCODE) for each items like the data bellow automatically without click my keyboard (after scan 4 barcode then go to row bellow):
Item Number Number1 Number2 IDBARCODE
KMJ15011988 AB12345 CD78901 IDBARCODE1234
NKH24061988 AB12346 CD78902 IDBARCODE1235
OTY27121988 AB12347 CD78903 IDBARCODE1236
JWY30041989 AB12348 CD78904 IDBARCODE1237
LJH25011990 AB12349 CD78905 IDBARCODE1238
HCS11021990 AB12350 CD78906 IDBARCODE1239
I have tried to scan all the barcode and the result always be like this :
Item Number Number1 Number2 IDBARCODE
KMJ15011988
AB12345
CD78901
IDBARCODE1234
NKH24061988
AB12346
CD78902
IDBARCODE1235
OTY27121988
AB12347
CD78903
IDBARCODE1236
JWY30041989
AB12348
CD78904
IDBARCODE1237
LJH25011990
AB12349
CD78905
IDBARCODE1238
HCS11021990
AB12350
CD78906
IDBARCODE1239
May you know how to fix it? Thank you so much for your help
You could continue to scan as you are doing and then convert the single column of data to the format you want. Assuming you scan data is in the first sheet, add a second sheet and run this. It will format the data in four columns.
function SPLIT() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sh0 = ss.getSheets()[0], sh1 = ss.getSheets()[1];
// get data from sheet 1
var data = sh0.getDataRange().getValues();
// create array to hold data
var aMain = new Array();
// itterate through data and add to array
for(var i=1, dLen=data.length-1; i<dLen; i=i) {
aMain.push([data[i][0],data[i+1][0],data[i+2][0],data[i+3][0]]);
i=i+4
}
// add array of data to second sheet
sh1.getRange(2, 1, aMain.length, 4).setValues(aMain);
}
Add your column headers to the second sheet.