Google Sheet to Firebase - sync data [duplicate] - firebase

function sortResponses() {
var Sheets = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Fall 01")
sheet.sort(3, false);
}
I have a Sheet called Fall 01 in my google Sheets, where I explicítly had to give the script access to, but it won't open, what am I missing?

Explanation/Issue:
The issue is that you have a standalone script which therefore is not bound to a google spreadsheet and as a result SpreadsheetApp.getActiveSpreadsheet() returns null.
Solutions:
There are two ways you can follow:
Solution 1:
Use SpreadsheetApp.openById(id) or SpreadsheetApp.openByUrl(url):
var Sheets = SpreadsheetApp.openById("Put your Spreadsheet ID").getSheetByName("Fall 01");
or
var Sheets = SpreadsheetApp.openByUrl("Put your Spreadsheet URL").getSheetByName("Fall 01");
Solution 2:
Go to the spreadsheet file that you want to work with and click on Tools => Script editor on the top menu of the spreadsheet file and put your current code there.
Please Note
If this is your only code, sheet is not defined, therefore you will get another error down the road. You most likely want to replace sheet with Sheets or the other way around. Be careful with this.

Related

Smartsheet api workspace sheet set

Thi is my first question.
I'm developing an exportation from our SQL based ERP to smartsheep.
We are developing in .NET (VB).
I'm creating / uploading sheet and creating data in row without problems.
My actual and almost last trouble is to be able to set a specified workspace...
Example.
I Upload a template XLSX file to smartsheet. I populate it with all the data i need to put inside, than (and here we are) i would like to set to the uploaded Sheet a specific workspace...
I'm using nuget smartsheet-csharp-sdk Version 2.126.0
Thank you for any reply.
This is more or less my code:
Dim smartsheet As SmartsheetClient = New SmartsheetBuilder().Build()
Dim sheet As Sheet = smartsheet.SheetResources.ImportXlsSheet(Dim XLSFILENAME as string, Nothing, 0, Nothing)
Than i have my build / upload rows code...
but no idea on how to set the workspace....
With the import ImportXlsSheet you can't set a destination, the sheet will be created at the root (home) or smartsheet.
You've to create the sheet, and by the response you should have access to the sheetId created.
With a second call to the API, move the sheet to the specific workspace. see also : https://smartsheet-platform.github.io/api-docs/?csharp#move-sheet

How to use googledrive::drive_upload() without changing the Google ID of file?

When I upload a pptx file to Drive (or any file) I'd like to maintain the Google ID for the file, but every time I execute this function, a new Google ID is created even when overwrite=TRUE. This breaks the hyperlink that stakeholders were using to find the file in Drive. Is there a way to maintain the Google ID when overwriting during upload?
googldrive::drive_upload(
my_pres,
name = "My Presentation",
type = 'presentation', # converts pptx to Googleslides
overwrite = TRUE
)
According to the documentation googledrive::drive_upload() wraps the Files.create method of the Drive API. That is the wrong function to use for updating a file. The overwrite argument set as TRUE stands for:
"[...] Check for a pre-existing file at the filepath. If there is zero or one, move a pre-existing file to the trash[...]"
You should use googledrive::drive_update() which wraps the Files.update method of the Drive API. From the R docs, is described as:
"[...] Update an existing Drive file id with new content ("media" in Drive API-speak), new metadata, or both. To create a new file or update existing, depending on whether the Drive file already exists, see drive_put(). [...]"

Is there a way to find the Frame name from Firebug without using console?

I have been trying to find if there is any way to find out the iframe name from Firebug, without having to use its built-in console.
I am aware that window.frames[x] will switch the window handle to "x"frame, but is there any way to just find out the name of the frame without having to use console, so that I can use the frame name in my Automation script?
I am now using Firepath to get the name of the frame, however, I was wondering if the same can be done using Firebug.
Thanks!
A simple way to find frames within the DOM structure is to use the HTML panel´s search (which allows to search for XPaths). So, just type in //frame (or //iframe for iframes) and you´ll be able to navigate through the different / elements.
The frames are also listed within the DOM panel.
Firebug also offers you a way to switch between different frame contexts via the cd() command, but it does not have a visual option for that.
Though the Firefox DevTools implement a button, which lists the different frames in a popup menu.
If you mean the name attribute when you speak about 'name', you can also get them easily using the following code:
var frames = document.querySelectorAll("frame, iframe");
var frameNames = [];
for (var i = 0; i < frames.length; i++) {
frameNames.push(frames[0].getAttribute("name"));
}

Exporting Several XtraGrid Controls to a Single Excel File

I've got several XtraGrid Controls each one containing different information, I get some information about the way in which you can export a XtraGrid to an Excel file in the following direction http://www.devexpress.com/Support/Center/p/Q362120.aspx
Now Is there any way to export the each XtraGrid Control to a single Excel file so that every XtraGrid information is exported to a different excel sheet.
I tried setting the exporting path direction to the same Excel file, but when the first exporting process is done, the second exporting process just overrides the excel file and so on.
I tried using the method described in this direction XtraGrid - Export To Excel , but I wanted to know if there is another way whithout using the interop excel libraries because I have experience some problems when using this library (I mean when using this library you create an Excel process but after you created it you cannot kill it, even though you have used the method that is supposed to do that).
Any help would be welcomed.
I just wanted to provide a more complete answer, since it took a while for me to get a solution together using D..'s answer.
And yes - it looks like I'm trying to print something, but I'm just exporting to Excel, I promise.
using DevExpress.XtraPrinting;
using DevExpress.XtraPrintingLinks;
using DevExpress.XtraGrid;
class whatever
{
GridControl grid1;
GridControl grid2;
//.....
public void exportToExcel()
{
using (var saveDialog = new SaveFileDialog())
{
saveDialog.Filter = "Excel (.xlsx)|*.xlsx";
if (saveDialog.ShowDialog() == DialogResult.OK)
{
var printingSystem = new PrintingSystemBase();
var compositeLink = new CompositeLinkBase();
compositeLink.PrintingSystemBase = printingSystem;
var link1 = new PrintableComponentLinkBase();
link1.Component = grid1;
var link2 = new PrintableComponentLinkBase();
link2.Component = grid2;
compositeLink.Links.Add(link1);
compositeLink.Links.Add(link2);
var options = new XlsxExportOptions();
options.ExportMode = XlsxExportMode.SingleFilePageByPage;
compositeLink.CreatePageForEachLink();
compositeLink.ExportToXlsx(saveDialog.FileName, options);
}
}
}
}
Hope it saves somebody a little time.
To do that you will want to add a printableComponentLink to each gridControl, and then Create a compositeLink that you can add each of the printableComponent links to.
This link may prove DevExpress KB Article may prove useful as it has an example of that.
Then you will use the compositeLink.ExportToXlsx method. If you create XlsxExportOptions with the XlsxExportOptions.ExportMode property equal to SingleFilePageByPage and pass it to the CompositeLink.ExportToXlsx method, every page will be exported to a separate sheet.
In above code, compositeLink.ExportToXlsx failed for me--no such method. Of course I am using V10.2.5, which is old. I suggest this link from the DEVXPRESS site that uses the ShowPreviewDialog method which allows exporting in a number of different formats. The link also shows how to do some customization of the output.
https://documentation.devexpress.com/#WindowsForms/clsDevExpressXtraPrintingLinksCompositeLinktopic

stylesheet for spreadsheet from .net using open xml sdk 2.0

I am actually bit confused to say. I googled for applying styles in my spreadsheet i got some functions in which they mention about the font, borders etc which i need but i dont know where should i use or how should i implement.
When i tried to implement like
cell.StyleIndex=8 // Which is modified as per my need but there is no effect in the cells
can any one help me what can be the issue and where would i done the mistake
OpenXml is one of those really complex framework that could use a framework to make certain common tasks easier. I would suggest starting with the OpenXml Productivity Tool (available in the SDK). Create a spreadsheet that has the styles you want, save it, then open it in the tool to view the code necessary to create the style you would like.
Basically, there is a stylesheet section within the workbook that contains the various formats that are available to your document. These formats are sequential and may be accessed via their index (the StyleIndex you mentioned above.
So, it's Friday. Enough talk, let's look at some code:
// Obtain a handle to the stylesheet
WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;
WorksheetPart worksheetPart = workbookPart.WorksheetParts.First();
Stylesheet stylesheet = workbookPart.WorkbookStylesPart.Stylesheet;
// Highlight format
CellFormat highlightPriceFormat = new CellFormat { NumberFormatId = (UInt32Value) 164U, FontId = (UInt32Value) 1U, FillId = (UInt32Value) 2U, BorderId = (UInt32Value) 0U, FormatId = (UInt32Value) 0U, ApplyNumberFormat = true, ApplyFont = true, ApplyProtection = true };
highlightPriceFormat.AppendChild(new Protection { Locked = false });
stylesheet.CellFormats.AppendChild(highlightPriceFormat);
The code above first obtains a handle to the workbook, then the worksheet, and finally the stylesheet for the worksheet. Once obtained, we create a new cell format that is based on the Currency format and highlighted in yellow.
I hope this is enough to get you started. There is information out there, but it is in bits-and-pieces all over the internet. This related question has another great example.

Resources