PlatformIO Community

Put PlatformIO Boards In A Spreadsheet


This text will be hidden

The PlatformIO board listing is formatted for each platform group by a Python pretty-print library. The fields do not align if pasted into a file and it is not structured like CSV or Json for computer input. A speadsheet view might be optionally desirable so I provide a Lua script to do that.

-- file: make_csv.lua
-- RMM; 2022.apr.17

  From PlatformIO boards.txt to boards.csv for spreadsheet view..
  The pio "boards" listing is not intended to be processed by a program.
  This Lua script fixes the irregular text format and outputs CSV.
  1. pio boards > btmp.txt
  2. Lua make_csv.lua
  3. Open boards.csv in a spreadsheet

local filename1 = "btmp.txt"    -- capture of "pio boards > btmp.txt"
local filename2 = "boards.csv"  -- output board list in CSV format
local header = "ID, MCU, Freq, Flash,  RAM, Platform, Remarks\n"
local num_out = 0
local line1 = ""

local strPlatform = ""
local numPlatforms = 0
local infile = assert(, "r"))
local outfile =,"w");
num_out = num_out+1

 local function parse_line(s1)
   -- skip lines malformed or not having MCU properties
   if not s1 then return end
   local x = string.sub(s1, 1,1)
   if x == '-' then return end
   if x == '=' then return end
   if string.sub(s1,1,2) == "ID" then return end
   if string.sub(s1,1,8) == "Platform" then
      strPlatform = string.sub(s1,10)
      numPlatforms = numPlatforms + 1

   -- capture the MCU properties from columns 1-5, skip spaces
   -- capture all the characters in the "name" column
   local a1,a2,a3,a4,a5,a6 = string.match( s1,
     "(%g+)%s* (%g+)%s* (%g+)%s* (%g+)%s* (%g+)%s* (.*)")
   if a6 then
        -- commas are invalid within a data field
   	a6 = string.gsub(a6, ",", "_" )

   local tmp = string.format("%s, %s, %s, %s, %s, %s, %s",
   if not a1 then return end
   -- the Bonfires have no MCU field
   if a1 == "bonfire-basic-dram" then return end
   if a1 == "arty-axi-dram" then return end
   -- print the CSV line and write it to the result file
   outfile:write(tmp .. "\n")
   num_out = num_out+1  
end  -- function parse_line()

----------------  main loop  -------------------
while true do
   line1 = infile:read()
   if not line1 then break end
   if type(line1) == "string" then

print("Lines out=", num_out)
print("Number Platforms =", numPlatforms)


-- end make_csv.lua


This text will be hidden