query to new google spreadsheets - google-visualization

I created a line chart using google visualization.
The code queries a google spreadsheet.
When I use a normal spreadsheet (line 1), it works.
When I use a new google spreadsheet (URL on line 2) I have this error:
Error in query: request time out
I have the following two queries with two different URL: the first working, the second no.
var query = new google.visualization.Query('http://spreadsheets.google.com/tq?key=0AgtmZPWzQ7lldEt2S2VLajBRQVNFLV9pRFY2bTRQLVE&transpose=0&headers=1&merge=COLS&range=E2%3AE64%2CF2%3AJ64&gid=0&pub=1', opts);
var query = new google.visualization.Query('http://spreadsheets.google.com/tq?key=1chFDkz5Fqus1ODgtdEGNt4Mq2nxnkKnuqbEB4LaZF6o&transpose=0&headers=1&merge=COLS&range=A1%3AA100%2CB1%3AF100&gid=0&pub=1', opts);
I played with the URL to find the right format. I am wondering if I cannot find the right format, or if the new google sheets do not work or work differently with queries.
If I just put the URL in a browser:
http://spreadsheets.google.com/tq?key=1chFDkz5Fqus1ODgtdEGNt4Mq2nxnkKnuqbEB4LaZF6o
It says the file does not exist (in the second case only, with the new google sheet)
This is the link to the spreadsheet:
new google spreadsheet (second one)

It seems one possible solution (from a google spreadsheet project team member) is to use:
"https://docs.google.com/spreadsheets/d/{key}/gviz/tq"
Basically, use "docs" instead of "spreadsheets" and add "/gviz/tq" to the end.
In my example, that would be:
https://docs.google.com/spreadsheets/d/1chFDkz5Fqus1ODgtdEGNt4Mq2nxnkKnuqbEB4LaZF6o/gviz/tq

Related

What is the equivalent of the SQL function REGEXP_EXTRACT in Azure Synapse?

I want to convert my code that I was running in Netezza (SQL) to Azure Synapse (T-SQL). I was using the built-in Netezza SQL function REGEXP_EXTRACT but this function is not built-in Azure Synapse.
Here's the code I'm trying to convert
-- Assume that "column_v1" has datatype Character Varying(3) and can take value between 0 to 999 or NULL
SELECT
column_v1
, REGEXP_EXTRACT(column_v1, '[0-9]+') as column_v2
FROM INPUT_TABLE
;
Thanks,
John
regexExtract() function is supported in Synapse.
In order to implement it, you need to use couple of things, here is a demo that i built, here im using the SalesLT.Customer data that is supported as a sample data in microsoft:
In Synapse -> Integrate tab:
Create new pipeline
Add dataflow activity to your pipline
In dataflow activity: under settings tab -> create new data flow
double click on the dataflow (it should open it) Add source (it can be blob storage / files on prem etc.)
add a derived column transformation
in derived column add new column (or override an existing column) in Expression: add this command regexExtract(Phone,'(\\d{3})') it will select the 3 first digits, since my data has dashes in it, its makes more sense to replace all characters that are not digits using regexReplace method: regexReplace(Phone,'[^0-9]', '')
add sink
DataFlow activities:
derived column transformation:
Output:
please check MS docs:
https://learn.microsoft.com/en-us/azure/data-factory/data-flow-derived-column
https://learn.microsoft.com/en-us/azure/data-factory/data-flow-expression-functions
Regex_extract is not available in T-SQL. Thus, we try to do similar functionalities using Substring/left/right functions along with Patindex function
SELECT input='789A',
extract= SUBSTRING('789A', PATINDEX('[0-9][0-9][0-9]', '789A'),4);
Result
Refer Microsoft documents patindex (T-SQL), substring (T-SQL) for additional information.

How to change a database name in a query via a URL in power bi

i am trying to change my database name in my advanced editor query in power bi. I know i can create parameters with in the power bi desktop app and pass the different database with in it. I have done this and it works fine.
But what i am trying to do is when i give a user a link for example
https://app.powerbi.com/groups/me/reports/DataSource="PowerBi_1"
how do i get the datasource name which is "PowerBi_1" and pass it into my advanced editor query which looks as follows
let
Source = Sql.Database(".", "PowerBi_2", [Query="select *#(lf)from Customer"])
in
Source
so i want to replace the Powerbi_2 with PowerBi_1
is this possible?
I tried searching and the only things i could find was to add parameters from "manage parameters" which i can already do. But i need it to be passed from the URL and automatically change the data source instead of manually changing it via "edit parameters"
i know you can use filter in your URL as https://app.powerbi.com/groups/me/reports/12345678-6418-4b47-ac7c-f8ac7791a0a7?filter=Customer/PostalCode eq '15012'
but this would only work on datasets. im not sure how to do this for a database change in a query
The only thing you could try is if you have a direct query and use the new feature of binding query parameters.
https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters
Then you can set a filter with url to point to the database you need. Not sure how it would work - haven't tried it myself.
To expand on the idea a bit - you would need a table with database names in it. Then you would bind database column of that table to your query parameter and finally, use your url to set appropriate filter on this new table.
EDIT:
Scratch that, in the article I linked to, it says that direct query T-SQL is not supported. But if they were ;)...

Include line breaks in Google Sheets cells when getting form responses from Google Forms

I am wondering if anyone can help with this. I am creating a merged document using HTTP Post via Infusionsoft from a Google Form Response. The HTTP Post automatically pulls the data from Infusionsoft and posts it to the Google Form which then adds it to a Google sheet. I am then using Autocrat to automatically create a letter.
I have managed to make all this work, however, the one issue that I am having is that some of the form entries are paragraph text (so, for instance, the body of the letter, which has several paragraphs). When I pull this data into the sheet once the HTTP post has fired, the text within that cell separates the paragraphs with <br><br>. So, for example, it would be:
"Paragraph one.<br><br>
Paragraph two.<br><br>" etc.
This then merges into the letter with the <br><br> rather than line breaks.
I want it to appear within the merged letter as:
"Paragraph one.
Paragraph two."
within the cell. Ie with line breaks.
Is this possible? Have found another post with this function, but this is the opposite of what I want to achieve.
function lineBreakTest() {
var cellWithLineBreaks = SpreadsheetApp.getActiveSheet().getRange("q3").getValue();
Logger.log(cellWithLineBreaks);
cellWithLineBreaks = cellWithLineBreaks.replace(/\n/g, '<br>');
Logger.log(cellWithLineBreaks);
// Post to your Google Site here. Logger.log is just used to demonstrate.
}
I would also want it to apply to the whole column, so whenever autocrat runs and a new row is added, it would apply the same function.
Would this all happen automatically also?
Any help would be amazing.
see this solution if it fits you:
=ARRAYFORMULA(REGEXREPLACE(A:B, "<br><br>", CHAR(10)&CHAR(10)))
...then you can just hide A:B columns

How do I save the web service response to the same excel sheet I extracted the data from?

For example:
The given sample HP Flights SampleAppData.xls and using the CreateFlightOrder, we can link the data to the test functions and get a OrderNumber and Price response from the Web Service. And in the SampleAppData.xls Input tab, we can see that there is a empty column of OrderNumber.
So here is my question, is there any ways that I can take the OrderNumber response and fill the empty column in SampleAppData.xls?
My point to do this is because, let's say I have many test cases to do and will take days, and today I do this certain test and I would need the result of today for the next day's test.
Although I know that the responses are saved in the result but it beats the point of automation if I am required to check the response for each and every test cases?
Yes of course you can. There are a number of ways to do this. The simplest is as follows.
'Datatable.Value("columnName","sheetName")="Value"
DataTable.Value(“Result”,”Action1”)=“Pass”
Once you have recorded the results in the Datasheet, your can export them using
DataTable.ExportSheet("C:\SavePath\Results.xls")
You can write back the response programatically , if you already imported mannually .
You can use GetDataSource Class of UFT API , it will work like this lets say you imported excel from FlightSampleData.xls, and named it as FlightSampleData, you have sheet, accessing the sheet will be like below:
GetDataSource("FlightSampleData!input).Set(ROW,ColumnName,yourValue);
GetDataSource("FlightSampleData!input).Get(ROW,ColumnName);
for exporting you can use ExportToExcelFile method of GetDataSourse class after your test run . Please let me know if you have any furthur question about this.

Oracle Apex link to BLOB from different table

I've got a form in which I want to display either a download link for a BLOB or use a file browser field to do the same.
I can manage the file browser method normally, however because the BLOB I want to refer to isn't part of the table the form is based on, I can't seem to get it to show properly.
The best I've got so far is a 'display only' field with an SQL query returning the size of the file.
If you are using Oracle Application Express, you may youse the "P" procedure.
Just like the "F" procedure that you it to show pages, the P procedure allows you to download files from apex.
for example :
http://apex.shellprompt.net/pls/apex/p?n=217605020644166778
where that number at the end is the primary key number form the
select id
from apex_application_files
To add a file to this table, simple add a browse-file item on a page. Run the page, browse for a file, and submit the page. It will automatically insert it in this table.
you can query it after :
select id
from apex_application_files
where filename = YOUR_FILE
good post for this is : http://dgielis.blogspot.com/2007/08/oracle-apex-fp-pn-zp.html
test it out, tell me if you get stuck