Example #1
0
    private static ExcelFile GetExcelFile(IDialogEditorContext context)
    {
        var fileId = context.FileList.Files[_selectedItem].Id;
        var model  = GoogleApi.GetSheets(context.Token, fileId);

        return(new ExcelFile()
        {
            Sheets = model.sheets.Select(sheet =>
            {
                var sheetName = sheet.properties.title;
                var sheetValues = GoogleApi.GetValuesInSheet(context.Token, fileId, sheetName);
                return new ExcelSheet()
                {
                    Name = sheet.properties.title,
                    Data = sheetValues
                };
            })
                     .ToArray()
        });
    }