// Load the Google Drive API gapi.load('client', initClient); function initClient() { gapi.client.init({ apiKey: 'dcbe46af5cc34d075c55aed84ab7a0e98bc1e88c', discoveryDocs: ['https://www.googleapis.com/discovery/v1/apis/drive/v3/rest'], }).then(function () { console.log('Google Drive API loaded'); }); } function searchWarranty() { var companyName = document.getElementById("companyName").value; var serialNumber = document.getElementById("serialNumber").value; // Use the Google Drive API to search for the file and retrieve data gapi.client.drive.files.get({ fileId: 'YOUR_FILE_ID', fields: 'name, webViewLink' }).then(function(response) { var file = response.result; var warrantyDetails = "Warranty details not found."; if (file) { // Use the file's webViewLink to access the file content var fileLink = file.webViewLink; // You need to implement code to fetch data from the file using the link // For example, you can use fetch() or other methods to access the file content // Replace the following lines with your actual implementation // In this example, we assume the file contains data in a specific format // and we parse it to find the warranty details if (fileLink.includes('example-document')) { // Parse the file content to find the warranty details // This is a simplified example, and you should adapt it to your file's format var fileContent = "Company Name,Serial Number,Warranty\nExample Company,12345,2 years warranty"; var rows = fileContent.split('\n'); for (var i = 1; i < rows.length; i++) { var columns = rows[i].split(','); if (columns[0] === companyName && columns[1] === serialNumber) { warrantyDetails = columns[2]; break; } } } } document.getElementById("result").innerHTML = warrantyDetails; }); }
top of page
bigstock-193790059.jpg

Warranty Check

bottom of page