How can I pass a number with leading zero's as a parameter in PQ?

JumboCactuar

Well-known Member
Joined
Nov 16, 2016
Messages
788
Office Version
  1. 365
Platform
  1. Windows
Hi, I've looked all over for a solution to this but nothing. I'm trying to pass a number as a parameter into a URL, keeping the leading zero's.

Example: 000129832 When I enter this it gets passed as 129832 which doesn't work in the URL

I have this:

Code:
    let SR=(ACNUM)=>
    let
        Source = Xml.Tables(Web.Contents("http://exampleurl.com?ACNUM="&Number.ToText(ACNUM))),

And when I enter 000129832 the invoked function shows error "Column of the table not found" as it is trying to load

http://exampleurl.com?ACNUM=129832

Appreciate any help with this

Also posted on Reddit: https://www.reddit.com/r/excel/comments/bzou90/cant_pass_number_into_url_keeping_leading_zeros/
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Does the 'number' you want to pass always have the same no of digits?

If it does you might want to look at Text.PadStart:

Source = Xml.Tables(Web.Contents("http://exampleurl.com?ACNUM="&Text.PadStart(Number.ToText(ACNUM), 9, "0"))),
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,985
Members
452,540
Latest member
haasro02

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