dates

JeffGrant

Well-known Member
Joined
Apr 7, 2021
Messages
558
Office Version
  1. 365
Platform
  1. Windows
HI all,

at the moment, I run queries that look like this everyday. (except for the API Key)

= Csv.Document(Web.Contents("https://old.puntingform.com.au/api/formdataservice/GetTrainerStrikeRateData/12-Jan-2023?ApiKey=XXXXXXXXXXXXXXXX"),[Delimiter=","])

The only part that changes is the date just before the API key. (in Red and Bold)

How can I set the query up so that the data is automatically changed to todays date without me having to edit every query?

Thaks for yoru help.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Thanks Micron, that is great for VBA, but not M code.

Anyway, I have got this far:

//fromDate = """" & DateTime.Date(DateTime.LocalNow()) & """",

fromDate = "12-Jan-2023",
Source = Csv.Document(Web.Contents("https://old.puntingform.com.au/api/formdataservice/GetTrainerStrikeRateData/" & fromDate &

I can get the "fromDate" variable to substitute ok, but I cant get the
Power Query:
DateTime.Date(DateTime.LocalNow()
syntax to pass as a string. I know I am missing something very simple. I have tried the DateTime.ToText function, but alas, I am not familiar enough with m code to work it out.

I am sure it has to do with the number of double quotes being used.

Thanks for your help
 
Upvote 0
Sorry, missed that this was for something else. Usually quoted double quotes ( """" ) is for when you want to encapsulate something like zls ( "" ) within quotes.
Three ( """ ) is for when you want to encapsulate one double-quote ( " ).
As for the rest, I know nothing about PowerQuery. If you assign a value to a string variable, I don't suppose you can output it as you would in vba in the immediate window. Seeing what it actually holds is often valuable in troubleshooting.
HTH
 
Upvote 0

Forum statistics

Threads
1,223,098
Messages
6,170,099
Members
452,301
Latest member
QualityAssurance

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top