How to select visibility of specific worksheet at the opening of Excel using Spreadsheet XML - worksheet

I am getting spreadsheet xml from a code logic (Flex Grids to spreadsheet xml).
I have 3 worksheets (A, B, C) in that spreadsheet xml.
I am opening this spreadsheet xml in Excel.
I want to view worksheet B when I am opening the spreadhseet xml in Excel.
Is there any tag/code, I need to add so that worksheet B will be visible at initial?
I can add that code in code logic
Thanks ... Atul

Add <ActiveSheet> tag in Namespace section of XMLSpreadsheet.
e.g. <ActiveSheet>1</ActiveSheet>, where 1 is the second worksheet of the spreadsheet excel.

Related

Transpose cell data into separate rows

I wanted to see if there was a formula or something that I could do to get something like this accomplished in Google Sheets.
Table 1 is the input I am getting
Table 2 is the output I want to generate on a separate sheet
I am trying to use output I get from a Google form into a Google sheet and create a CSV to import into Google Groups.
=ARRAYFORMULA(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
IF(IFERROR(SPLIT(B2:B, ","))<>"", "♦"&SPLIT(B2:B, ",")&
REGEXEXTRACT(A2:A, "(#.*)")&"♣"&A2:A, )),,999^99)),,999^99), "♦")), "♣")))

How to create a pygsheets worksheet without the default sheet1?

Is there a way to create a pygsheets worksheet without the default sheet1?
Looking through the documentation didn't help, but googling seems to indicate that it's possible to eliminate sheet1 in excel, so presumably, it should be possible in pygsheets.
sheet1 just refers to the first sheet which is automatically created when you creates the spreadsheet. It is automatically created by google sheets and you can't control it from any library. google sheets required you to have at-least one worksheet in a spreadsheet. So you cannot remove all the sheets.
But if you just want to remove the sheet named sheet1, you can do
sh.del_worksheet(sh.sheet1)
or if you wanna rename it , you can do
sh.sheet1.title="new_sheet"
Simply rename the default sheet1 to your desired worksheet name (my_sheet1)
sh = gc.create("my_google_sheet", parent_id="56uyjJcWghbtyuwA")
wks = sh.sheet1
# rename to your desired worksheet name
wks.title = ('my_sheet1')

Iterating through data from a SOAP Response to store in an Excel Worksheet

I know that there is a DataLoop that can be used to iterate over elements in a DataSource, but how do I iterate over elements that I am extracting into a DataSink?
I have a SOAP Response containing 100 records and I need to extract different elements from each record and store the data in an Excel worksheet. Currently I am extracting the data with a Property Transfer and using a DataSink to save it to a spreadsheet. Below is an example of the code that takes the first author name in each record and transfers it to the DataSink (this is within the Source section of the Property Transfer window):
declare namespace ns2='http://woksearch.v3.wokmws.thomsonreuters.com';
declare namespace ns1='http://scientific.thomsonreuters.com/schema/wok5.4/public/FullRecord';
<full_name>
{
for $id in //ns1:name[1]//ns1:full_name[1]
return string($id)
}
</full_name>
However, this takes ALL the names from every record as a list and stores them in a single cell in the Excel worksheet (similarly for the other data fields I'm extracting). How can I do the Property Transfer for the 1st record into the DataSink, then iterate back to do the Property Transfer for the 2nd record, and so on until I have iterated over all 100 records?
Thank you for your help!
John
EDIT:
Here is an example of the XML Document I am trying to retrieve data from, I have taken out some elements as it is extremely long otherwise!:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:retrieveByIdResponse xmlns:ns2="http://woksearch.v3.wokmws.thomsonreuters.com">
<return>
<queryId>2</queryId>
<recordsFound>100</recordsFound>
<recordsSearched>50601246</recordsSearched>
<records><records xmlns="http://scientific.thomsonreuters.com/schema/wok5.4/public/FullRecord">
<REC r_id_disclaimer="ResearcherID data provided by Thomson Reuters"> <UID>WOS:000266862400001</UID><static_data><summary><EWUID><WUID coll_id="WOS"></WUID><edition value="WOS.SCI"></edition><names count="3"><name seq_no="1" addr_no="1" role="author" reprint="Y"><display_name>Buijs, Arjen E.</display_name><full_name>Buijs, Arjen E.</full_name> ... etc ... </REC>
<REC> ... etc ... </REC>
<REC> ... etc ... </REC>
</records></records>
</return>
</ns2:retrieveByIdResponse>
</soap:Body>
</soap:Envelope>
All the data I am extracting lies within these <REC> tags, so I am trying to extract fields like <full_name> from each <REC> and then pass it into an Excel spreadsheet.
I have managed to display the data exactly as I want it by using a DataSource step just after this SOAP Request/Response which extracts all the necessary fields by using the DataSource as XML and then referencing the XPath of each in the Row and Column sections. When I click the green test button in this window, the Data Log displays all 100 records with a column for each field type. When I try to pass all this data into a DataSink however, it only copies over the first row 100 times into the Excel worksheet.
Sorry, I would post a screenshot but you need reputation 10+ to do that!
EDIT 2:
For example, for the field <full_name> I have made a property called Author 1 in the DataSource, set to XML, Source Step is the SOAP Request and Source Property is the Response (the data listed in the code block above). In the Row XPath I then have:
declare namespace ns2='http://woksearch.v3.wokmws.thomsonreuters.com';
declare namespace ns1='http://scientific.thomsonreuters.com/schema/wok5.4/public/FullRecord';
//ns2:retrieveByIdResponse[1]/return[1]/records[1]/ns1:records[1]/ns1:REC
In the Column XPaths I have:
declare namespace ns1='http://scientific.thomsonreuters.com/schema/wok5.4/public/FullRecord'; ns1:static_data/ns1:summary/ns1:names/ns1:name[1]/ns1:full_name/text()
When I run the test in this window, this displays a column with the header 'Author 1' and then lists 100 different names. When I transfer this to a DataSink however, it only lists the first row 100 times in the worksheet.
Your query will put all the first names into a single XML element called full_name. However I think you want to output them independently, but then all you would need is this:
declare namespace ns1 = 'http://scientific.thomsonreuters.com/schema/wok5.4/public/FullRecord';
//ns1:name[1]//ns1:full_name[1]
You need to follow a sequence something like this:
SOAP call to retrieve your data.
DataSource with type = xml to grab all the records, one at a time.
DatasSink to write each one record to your Excel.
Loop back to #2 to iterate over all the records.

Apex - Interactive Report - Hide Column in CSV Download?

I've got an interactive report in Apex with some columns.
The user has the option to download the report as CSV file with the standard functionality.
Is there a way to hide a column in the export but display it on the screen.
(Background: one column is a custom link that should not be exported into the CSV)
Thank you !
Paul
You can hide it by putting a condition on the column of type PL/SQL Expression and using the following as the expression:
NVL(:REQUEST,'EMPTY') NOT IN('CSV','XLS','PDF','XML','RTF','HTMLD')
That will check the APEX bind variable "REQUEST", and if it is CSV, XLS, PDF, XML, RTF or HTML then the column will not be shown!
More info
To stop a column from showing up for an email, you can use the following:
NVL(wwv_flow.g_widget_action, 'EMPTY') != 'SEND_EMAIL'
This one did not work for me:
NVL(:REQUEST,'EMPTY') NOT IN('CSV','XLS','PDF','XML','RTF','HTMLD')
So another workaround could be the following:
instr(nvl(:REQUEST,'~'),'XLS') = 0 and instr(nvl(:REQUEST,'~'),'PDF') = 0 and instr(nvl(:REQUEST,'~'),'HTMLD') = 0
Same logic applies for csv, rtf, etc.
The most upvoted answer didn't work for me.
The workaround from #George worked for me as well:
instr(nvl(:REQUEST,'~'),'XLS') = 0 and
instr(nvl(:REQUEST,'~'),'CSV') = 0
I applied this at an Interactive Report column (APEX 21.2)

Dynamically set column in sum formula using aspose.cells

I am use aspose excel export. I am setting formulla in .net.
I want sum of two cells value in third cell. like
excelbook.Worksheets[0].Cells["A2"].R1C1Formula = "=SUM(R1C1,R1C2)";
but i want to set the column dynamically. like in above formulla column C1,C2 are fixed.
now i want pick the column name dynamically , i want to build my formulla like below
excelbook.Worksheets[0].Cells["A2"].R1C1Formula = "=SUM(R1C(Value of Cell B1),R1C(Value of Cell B2))";
so if i enter 1 in B1 cell and 3 in B2 cell then it should sum A1 and C1.i can enter any value in B1 and B2 cell and excel should calculate the sum based upon entered values.
Please suggest how to build this type of formulla.
directly in excel we can do by this way:-
=INDIRECT(B1&1)+INDIRECT(B2&1)
so please suggest can i use INDIRECT in r1c1 formulla or suggest some other way.
If you want to add D1 and E1 in Excel but you want to select the row based on the value of the particular cell; for example, in this case, you might use A1 and A2 to place the value of the row to select, then you will use the formula like this:
=SUM(INDIRECT("D"&$A$1),INDIRECT("E"&$A$2))
You can assign the same formula using Aspose.Cells for .NET as well. Please see the following code:
//create XLS File
//Instantiate a Workbook object that represents Excel file.
//create a workbook
Workbook CellsDocument = new Workbook();
//Note when you create a new workbook, a default worksheet
//"Sheet1" is added (by default) to the workbook.
//Access the first worksheet "Sheet1" in the book.
Worksheet sheet = CellsDocument.Worksheets[0];
//Access the cells and put values
Aspose.Cells.Cell cellA1 = sheet.Cells["A1"];
cellA1.PutValue(1);
Aspose.Cells.Cell cellA2 = sheet.Cells["A2"];
cellA2.PutValue(1);
Aspose.Cells.Cell cellD1 = sheet.Cells["D1"];
cellD1.PutValue(4);
Aspose.Cells.Cell cellE1 = sheet.Cells["E1"];
cellE1.PutValue(5);
Aspose.Cells.Cell cellE14 = sheet.Cells["E14"];
cellE14.R1C1Formula = "=SUM(INDIRECT(\"D\"&$A$1),INDIRECT(\"E\"&$A$2))";
//Save the Excel file.
CellsDocument.Save("output.xls", Aspose.Cells.SaveFormat.Excel97To2003);
Please try it at your end using the latest version of the Aspose.Cells for .NET. If you think it doesn't help or I'm unable to understand your question clearly then please share your further thoughts.
Disclosure: I work as a developer evangelist at Aspose.