Hi I am trying to write a Windows Gadget that reads out information from an Excelsheet. The Excelsheet entails a the dates, formated, of the whole year in column A2:A366 and the following columns are the names of the employes B1:Q1.
The gadget is to display the current day and who is marked absent. For each day a person is absent the cell is marked with an X.
I am not a Javascript programmer. And need help. I think I have the basic setup already, and I hope you can help me find my missings.
Explanation:
With the getToday function I am trying to get the date from the PC and format it to a string which I want to use to find in the Column A, which is set to be an array. The same function ist ment to give me back the right row in which it should look for the Xs. If it finds an X it is supposed to return the name of the column ie the name of the employee.
function getToday (){
var today;
var currentDate = new Date()
var day = currentDate.getDate()
var month = currentDate.getMonth() + 1
var year = currentDate.getFullYear()
today = d.toString (day + "." + month + "." + year);
}
function refreshData(){
oExcel = new ActiveXObject('Excel.Application');
oWkBooks = oExcel.Workbooks.Open("C:\\Program Files\\Windows Sidebar\\Gadgets\\ExcelGadget.Gadget\\test.xlsx");
oExcelSheet = oWkBooks.Worksheets();
oExcelSheet.Activate();
oExcel.ActiveWorkbook.RefreshAll();
oExcel.ActiveWorkbook.SaveAs("C:\\Program Files\\Windows Sidebar\\Gadgets\\ExcelGadget.Gadget\\test.xlsx");
oWkBooks.Close();
location.reload();
}
function fetchData() {
function fetchData() {
$('#msg').html("Loading...");
$('#msg').show();
var oExcel;
var oExcelSheet;
var oWkBooks;
var cols;
oExcel = new ActiveXObject('Excel.Application');
oWkBooks = oExcel.Workbooks.Open("C:\\Program Files\\Windows Sidebar\\Gadgets\\ExcelGadget.Gadget\\test.xlsx");
}
function findToday(stringArray){
for (var j=0; j<stringArray.length; j++) {
if (stringArray[j].match (var today) return cell;
return -1;
}
function returnAbwesentheit() {
var name = name.arr;
for (i=2;i<x.length;i==23) {
if ("cell"=="x") {
document.write (Name(cell));
else
return null;
}
}
::UPDATE::
I had a flash of inspiration. I think I am making this to difficult for myself. Maybe I could make excel do the finding of the date and who is absent. Then I would only generate the Outcome with Javascript into the Windows Gadget.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.