From google sheet app script Call js function resides in chrome extension

34 views Asked by At

I have google chrome extension which has a function called var jsonString = readCard() on running this method it read the smart card by interacting to USB card reader and jsonString gets data.

from normal heml pages I am calling this as

var jsonString = readCard();
var jsonObj =JSON.parse(jsonString);
$('.txtName').val(jsonObj.name);
$('.txtPhone').val(jsonObj.phone);

But I want to call this funciton in Google sheet and instead of textboxes I want to populate data in google sheet.
I tried below but it says referenceError: readCard is not defined

my curren app code script is as below

function onOpen() {
  SpreadsheetApp.getUi()
      .createMenu('Smart Card')
      .addItem('Read Card', 'readCardFunction')
      .addToUi();
}

function readCardFunction() { 
  const data = readeid();
  const sheet = SpreadsheetApp.getActiveSheet();
  sheet.appendRow(data);
}
0

There are 0 answers