On Mon, Jul 28, 2025 at 10:44:36 -0500, Richard Owlett wrote:
> [1] 
> https://www.fns.usda.gov/sites/default/files/media/file/TFP-2021-Disaggregated-Market-Basket.xlsx

I was unable to download this with wget -- it just hung for a while.
But when I pasted the URL directly into a web browser, the browser was
able to download it.

Now, my choices at that point were to install Libre Office, or to try
to get Google Sheets to open it.  I was able to do the latter, by
opening a new Google Sheet, clicking File -> Import, clicking Upload,
then selecting the file I had just downloaded.  (My attempts to use
the =IMPORT* functions were not successful, but the "save to a local
file and then re-upload it" approach worked for me.)

The spreadsheet has three tabs: "Cover Sheet", "Codebook" and
"Disaggregated Market Basket".  I'm guessing you want data from the
last sheet.  That sheet has 3574 rows, and columns up to "AK", which I
believe means there are 37 columns.

Clicking File -> Download -> Comma Separated Values (.csv), I was
then able to download a .csv file, which starts out looking like this:


EC,EC_Description,Form,Form_Description,TFP_Market_Basket_Category,amount_reffam,cost_reffam,amount_child1,amount_child2_3,amount_child4_5,amount_child6_8,amount_child9_11,amount_female12_13,amount_female14_19,amount_female20_50,amount_female51_70,amount_female71_,amount_male12_13,amount_male14_19,amount_male20_50,amount_male51_70,amount_male71_,cost_child1,cost_child2_3,cost_child4_5,cost_child6_8,cost_child9_11,cost_female12_13,cost_female14_19,cost_female20_50,cost_female51_70,cost_female71_,cost_male12_13,cost_male14_19,cost_male20_50,cost_male51_70,cost_male71_

1001,"Butter, salted",RFG-RTS,"Refrigerated, ready-to-serve",Table fats and 
oils,0.1626786879,0.6186631041,0.01103253659,0.02083454713,0.01311547854,0.01769687127,0.0594166627,0.0348792245,0.01777270695,0.02197901726,0.01769234628,0.01677677253,0.061227006,0.06206025684,0.06358613667,0.06657438278,0.02314869676,0.04193037519,0.07880153702,0.04964098172,0.06735002221,0.226375425,0.1330267759,0.06830603059,0.08345215056,0.06651598271,0.06313037276,0.2333988445,0.2363390769,0.2414855064,0.2524536485,0.08728644348

1002,"Butter, whipped, with salt",RFG-RTS,"Refrigerated, ready-to-serve",Table 
fats and 
oils,0.02686947962,0.1381845124,0.0007728399987,0.003071941992,0.0008396139053,0.001147128895,0.01186825664,0.005297700659,0.001120978168,0.001708961753,0.001204639328,0.001301059988,0.01156720408,0.01199097977,0.01214513233,0.01345645264,0.001612712113,0.003964704841,0.01572173404,0.004266059726,0.005888717654,0.06109367429,0.02728689243,0.005832244741,0.00877883251,0.006083262385,0.006612304656,0.05951829381,0.06171136119,0.06242328791,0.06914126498,0.008188846043

1006,"Cheese, brie",RFG-RTS,"Refrigerated, 
ready-to-serve",Cheese,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

1009,"Cheese, cheddar",RFG-RTS,"Refrigerated, 
ready-to-serve",Cheese,0.09564044753,0.4865185748,0.009252925692,0.007254100156,0.004298026763,0.01669776985,0.01847750597,0.01767685543,0,0.05235453817,0.01620682648,0.001632507078,0.01243808671,0.005561730818,0.008110633541,0,0,0.04954928577,0.03430869868,0.01911904212,0.08547814057,0.09453849941,0.0913920653,0,0.270423159,0.079955161,0.008555077603,0.06407827851,0.024740415,0.03607877588,0,0


The process of pasting into this email introduced blank lines, which I
have left in place.  They actually make it more readable.

So, that's one way you can convert this spreadsheet into a .csv file,
without even needing to install an office suite.

>From here, anything that can handle CSV input should be able to deal with
this.  Having the internal commas within the two description fields, with
double quotes around them, is fairly common, and any decent CSV library
should be able to cope with that.

Would you like us to do anything more at this point (e.g. writing a
proof-of-concept field extraction in some scripting language), or do
you want to approach the data with your own preferred toolset?  Either
way's good, just let us know if you need any more help.

Reply via email to